// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: GHZ Setup Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

public alias  256 		: GROUP_PLAYERS
public alias  65536 	: HITBOX_AUTO
public alias  arrayPos6 : currentPlayer

//-------Aliases-------//

private alias Object.Value0 : Object.Timer
private alias Object.Value1 : Object.AltTimer

//Background

private alias Object.Value2 : bg.scrollfront
private alias Object.Value3 : bg.scrollback
private alias Object.Value4 : background.timer
private alias Object.Value5 : bg.alpha

//Hud Bar

private alias Object.Value6 : HUD.Ypos
private alias Object.Value7 : HUD.Slider

//Extra

private alias Object.Value8 : Screen.AdjustX
private alias Object.Value9 : Screen.AdjustY

private alias Object.Value10 : Object.charY

//Players

private alias Object.Value11 : Player.Xpos
private alias Object.Value12 : Slender.Xpos

//Text

private alias object.value13 : object.index

private alias object.value14 : object.drawX
private alias object.value15 : object.drawY
private alias object.value16 : object.letter
private alias object.value17 : object.charamount

//idk

private alias Object.Value18 : Options.Ypos
private alias Object.Value19 : Options.Slider
private alias Object.Value20 : Options.AdjustY
private alias Object.Value21 : Options.Selected
private alias Object.Value22 : Options.State

private alias Object.Value23 : Menu.AttackBar
private alias Object.Value24 : Menu.AttackDamage
private alias Object.Value25 : Menu.AttackRadius
private alias Object.Value26 : Menu.AttackLowerR

private alias Object.Value27 : Menu.DmgNumberY

private alias Object.Value28 : Object.TableContainer


private alias Object.Value29 : Object.TableTimer
private alias Object.Value30 : Slender.AnimTimer

//Soul

private alias Object.Value31 : Text.Proceed	//those who
private alias Object.Value32 : Act.Selection
private alias Object.Value33 : Object.AttackTimer
private alias Object.Value34 : Item.Selection

private alias Object.Value35 : Mercy.Attack
private alias Object.Value36 : Mercy.NumberY

private alias Object.Value37 : Attack.Property
private alias Object.Value38 : Final.Fade

private alias Object.Value39 : Freddy.Xpos
private alias Object.Value40 : Freddy.Ypos

private alias Object.Value41 : Slender.Ypos
private alias Object.Value42 : Object.TouchTimer
private alias Object.Value43 : Object.ActedMercy

private alias Object.Value44 : Object.BoxLength

public alias saveRAM[286] : saved.language

// State aliases
private alias 0  : DELTA_WAIT_0
private alias 1  : DELTA_ALERT_1
private alias 2  : DELTA_START_2
private alias 3  : DELTA_BATTLEIDLE_3
private alias 4  : DELTA_DIALOGUE_4
private alias 5  : DELTA_ATTACKSTART_5
private alias 6  : DELTA_ATTACKING_6
private alias 7  : DELTA_ATTACKEND_7

private alias 8  : DELTA_BATTLEEND_8
private alias 9  : DELTA_FINALDIALOGUE_9

private alias 90  : DELTA_DIED_90	//black screen
private alias 91  : DELTA_DIED_FADEIN_91	//fade in game over
private alias 92  : DELTA_DIED_GAMEOVER_92	//fade in game over

// Menu aliases
private alias 0  : DELTAMENU_FIGHT_0
private alias 1  : DELTAMENU_ACT_1
private alias 2  : DELTAMENU_ITEM_2
private alias 3  : DELTAMENU_SPARE_3
private alias 4  : DELTAMENU_DEFEND_4

//Option States
private alias 0  : DELTAOPT_CHOOSING_0

private alias 1  : DELTAOPT_FIGHT_PICKTARGET_1
private alias 2  : DELTAOPT_FIGHT_ATTACKING_2	//the bar
private alias 3  : DELTAOPT_FIGHT_RESULTS_3	//the effects of hitting
private alias 4  : DELTAOPT_FIGHT_EFFECTS_4	//numbers and proceeding to slendermans turn

private alias 5  : DELTAOPT_ACT_PICKTARGET_5
private alias 6  : DELTAOPT_ACT_CHOOSEACT_6

private alias 7  : DELTAOPT_ITEM_CHOOSEITEM_7
private alias 8  : DELTAOPT_ITEM_USEITEM_8

private alias 9  : DELTAOPT_SPARE_CHOOSETARGET_9
private alias 10  : DELTAOPT_SPARE_MERCYCHECK_10

private alias 0  : DELTATARGET_SLENDERMAN_0
private alias 1  : DELTATARGET_FREDDY_1

public alias saveRAM[295]: saved.mobile

public alias saveRAM[6905] : saved.SlenderOST

reserve function Delta_BG
reserve function Delta_HUD
reserve function Delta_TextDrawing
reserve function Delta_PlayerHUD
reserve function Delta_TalkingText
reserve function Delta_CharAnim
reserve function Delta_AliveDialogue
reserve function Delta_DeadDialogue
//please
reserve function AutoMobile
reserve function Delta_TouchDraw

public value Delta_HP = 90;
public value Delta_YourTurn = 1;

public value Delta_SlenderHP = 100;
public value Delta_FreddyHP = 100;
public value Delta_SlenderMercy = 0;
public value Delta_FreddyMercy = 0;
public value Delta_AttackTarget = 0;

public value Delta_TextProgression = 0;
public value Delta_IsTalking = 0;	//0 = You; 1 = Slenderman; 2 = Freddy

public value Delta_ActFlirted = 0;
public value Delta_BottomText = 0;
public value Delta_BecomeGreen = 0;
public value Delta_RingsUsed = 0;
public value Delta_ShowMercy = 0;
public value Delta_TP = 0;
public value Delta_Defending = 0;
public value Delta_Attacker = 0;		//0	= S;	1 = F

public value Delta_AttackOrder = 0;
public value Delta_AttackHardMode = 0;
public value PlayerDied = 0;
//0 = Alive, 1 = Dead, 2 = Spared
public value SlenderSpared = 0;
public value FreddySpared = 0;
//0 = Alive, 1 = Dead, 2 = Spared
public value Delta_Activate = 0;


public table NumberBounce
	2, 3, 2, 0, 2, 3, 2, 0, 2, 3, 2, 0, 1, 0, 0
end table

public table SlenderBounce
	0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -2, 0, 1, 0, 0,
end table

//IMPORTANT KEYS:

//Delta_TextProgression

//Ending: Spared
//99 - 105

//Ending: Killed
//106-

function AutoMobile
	CheckTouchRect(0, 0, screen.xsize, screen.ysize)
	if checkResult == -1
		Object.TouchTimer = false
	end if
	if Object.TouchTimer == 0
		CheckTouchRect(0, 96, screen.xcenter, screen.ysize)
		if checkResult > -1
			arrayPos0 = checkResult
			temp0 = touchscreen[arrayPos0].xpos
			temp0 -= 56
			temp1 = touchscreen[arrayPos0].ypos
			temp1 -= 184
			ATan2(temp2, temp0, temp1)
			temp2 += 16
			temp2 &= 255
			temp2 >>= 5
			if object.state == DELTA_ATTACKING_6
				switch temp2
				case 0
					inputdown[currentPlayer].right = true
					break
				case 1
					inputdown[currentPlayer].right = true
					inputdown[currentPlayer].down = true
					break
				case 2
					inputdown[currentPlayer].down = true
					break
				case 3
					inputdown[currentPlayer].down = true
					inputdown[currentPlayer].left = true
					break
				case 4
					inputdown[currentPlayer].left = true
					break
				case 5
					inputdown[currentPlayer].left = true
					inputdown[currentPlayer].up = true
					break
				case 6
					inputdown[currentPlayer].up = true
					break
				case 7
					inputdown[currentPlayer].up = true
					inputdown[currentPlayer].right = true
					break
				end switch
			else
				switch temp2
				case 0
					inputPress[currentPlayer].right = true
					break
				case 1
					inputPress[currentPlayer].right = true
					inputPress[currentPlayer].down = true
					break
				case 2
					inputPress[currentPlayer].down = true
					break
				case 3
					inputPress[currentPlayer].down = true
					inputPress[currentPlayer].left = true
					break
				case 4
					inputPress[currentPlayer].left = true
					break
				case 5
					inputPress[currentPlayer].left = true
					inputPress[currentPlayer].up = true
					break
				case 6
					inputPress[currentPlayer].up = true
					break
				case 7
					inputPress[currentPlayer].up = true
					inputPress[currentPlayer].right = true
					break
				end switch
				Object.TouchTimer = 1
			end if
		end if
		CheckTouchRect(screen.xcenter, 96, screen.xsize, 240)
		if checkResult > -1
			inputDown.buttonA = 1
			Object.TouchTimer = 1
		end if
		if touchJump == 0
			inputPress.buttonA |= inputDown.buttonA
		end if
		touchJump = inputDown.buttonA
		
		CheckTouchRect(0, 0, 122, 56)
		if checkResult > -1
			inputDown.buttonB = 1
		end if
		if touchDebug == 0
			inputPress.buttonB |= inputDown.buttonB
		end if
		touchDebug = inputDown.buttonB
	
	end if
end function

function Delta_TouchDraw

	temp0 = screen.xsize
	temp0 -= 44
	DrawSpriteScreenFX(199, FX_INK, 26,1 49) //dpad
	temp0 -= 39

	//movement
	
	temp0 -= 10
	if inputDown.Left==1
		DrawSpriteScreenFX(201,  FX_INK, 26, 151)
	endif
	if inputDown.Down==1
		DrawSpriteScreenFX(200,  FX_INK, 26, 189)
	end if
	if inputDown.Right==1
		DrawSpriteScreenFX(202, FX_INK, 64, 151)
	endif
	if inputDown.Up==1
		DrawSpriteScreenFX(199,  FX_INK, 26, 151)
	endif
	
	temp0 += 15	
	//jump
	if inputDown.buttonA==1
		DrawSpriteScreenFX(205,FX_INK,  temp0, 163)	
	else
		DrawSpriteScreenFX(204, FX_INK, temp0, 163)
	endif

	if inputDown.buttonB==1
		DrawSpriteScreenFX(207, FX_INK, 32, 6)	
	else
		DrawSpriteScreenFX(206, FX_INK, 32, 6)
	endif

	
end function

function Delta_DeadDialogue

end function


function Delta_AliveDialogue

	// Are you ready@ for Freddy?
	// I hope your@ ready for my @  pizza attack!
	// The family@ combo is @  now on sale!
	// What?
	// All you can eat@ at Freddy Fazbears@  Pizzeria!
	// Are you just@ promoting your@ pizzeria??
	// Yeah
	// bruh.

	//ACTUAL BATTLE
	switch Delta_TextProgression
		case 8	//ready 4 freddy?
			Delta_IsTalking = 2	
			Object.index = 58
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
				Text.Proceed = 1
			end if				
		break				
		case 9	// I hope your@ ready for my @  pizza attack!
			Delta_IsTalking = 2		
			Object.index = 59
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
				Text.Proceed = 1
			end if				
		break			
		case 10	 // The family@ combo is @  now on sale!
			Delta_IsTalking = 2		
			Object.index = 60
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
			end if				
		break		
		case 11 // What?
			Delta_IsTalking = 1		
			Object.index = 61
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
				Text.Proceed = 1
			end if				
		break		
		case 12	 // The family@ combo is @  now on sale!
			Delta_IsTalking = 2		
			Object.index = 62
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
			end if				
		break		
		case 13 // What?
			Delta_IsTalking = 1		
			Object.index = 63
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
				Text.Proceed = 1
			end if				
		break		
		case 14	 // The family@ combo is @  now on sale!
			Delta_IsTalking = 2		
			Object.index = 64
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
			end if				
		break		
		case 15 // What?
			Delta_IsTalking = 1		
			Object.index = 65
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
				Text.Proceed = 1
			end if				
		break			
		case 16
			Delta_IsTalking = -1
			object.charamount = 0
			Delta_TextProgression++
			Text.Proceed = 1
		break
		case 17 // What?
			Delta_IsTalking = 1		
			Object.index = 66
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
			end if				
		break				
		case 18 // What?
			Delta_IsTalking = 2	
			Object.index = 67
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
			end if				
		break				
		case 19 // What?
			Delta_IsTalking = 1	
			Object.index = 68
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
				text.proceed = 1
			end if				
		break		
		case 20
			Delta_IsTalking = -1
			object.charamount = 0
			Delta_TextProgression++
			Text.Proceed = 1
		break			
		case 21 // What?
			Delta_IsTalking = 2	
			Object.index = 69
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
			end if				
		break				
		case 22 // What?
			Delta_IsTalking = 1	
			Object.index = 70
			CheckEqual(inputpress.start, 1)
			temp0 = checkResult
			CheckEqual(inputpress.buttonA, 1)
			temp0 |= checkResult				
			if temp0 == 1
				object.charamount = -1
				Delta_TextProgression++
				Object.index++
				text.proceed = 1
			end if				
		break		
		default
			Delta_IsTalking = -1
			object.charamount = 0
			Text.Proceed = 1
		break											
	end switch
end function

function Delta_CharAnim
			
	switch object.state
	case DELTA_BATTLEIDLE_3
		switch Options.state
			case DELTAOPT_FIGHT_EFFECTS_4

				if Slender.AnimTimer > 0
					Slender.AnimTimer--
				end if

				if Delta_AttackTarget == DELTATARGET_SLENDERMAN_0	//slenderman hurnt
					switch options.State
					case DELTAOPT_FIGHT_EFFECTS_4
						if Slender.AnimTimer > 0
							if menu.AttackDamage > 0
								DrawSpriteScreenXY(55, Slender.Xpos, Slender.Ypos)
							else
								DrawSpriteScreenXY(197, Slender.Xpos, Slender.Ypos)						
							end if
						else
							DrawSpriteScreenXY(197, Slender.Xpos, Slender.Ypos)
						end if
					break
					default
						DrawSpriteScreenXY(197, Slender.Xpos, Slender.Ypos)	
					break
					end switch
					if FreddySpared > 0	//dead or spared
						DrawSpriteScreenXY(196, Freddy.Xpos, Freddy.Ypos)		
					else	//normal
						DrawSpriteScreenXY(193, Freddy.Xpos, Freddy.Ypos)		
					end if
				else
					if SlenderSpared > 0
						DrawSpriteScreenXY(198, Slender.Xpos, Slender.Ypos)
					else
						DrawSpriteScreenXY(197, Slender.Xpos, Slender.Ypos)
					end if
					//ow fred!
					if Slender.AnimTimer > 0
						if menu.AttackDamage > 0
							DrawSpriteScreenXY(195, Freddy.Xpos, Freddy.Ypos)
						else
							DrawSpriteScreenXY(193, Freddy.Xpos, Freddy.Ypos)						
						end if
					else
						if FreddySpared > 0	//dead or spared
							DrawSpriteScreenXY(196, Freddy.Xpos, Freddy.Ypos)		
						else	//normal
							DrawSpriteScreenXY(193, Freddy.Xpos, Freddy.Ypos)		
						end if
					end if	
				end if

				break
				default
					if SlenderSpared > 0
						DrawSpriteScreenXY(198, Slender.Xpos, Slender.Ypos)
					else
						DrawSpriteScreenXY(197, Slender.Xpos, Slender.Ypos)
					end if

					if FreddySpared > 0	//dead or spared
						DrawSpriteScreenXY(196, Freddy.Xpos, Freddy.Ypos)		
					else	//normal
						DrawSpriteScreenXY(193, Freddy.Xpos, Freddy.Ypos)		
					end if
				break
			end switch
		break
		case DELTA_DIALOGUE_4
			if Text.Proceed != 3
				if Delta_TextProgression > 6
					if SlenderSpared > 0
						DrawSpriteScreenXY(198, Slender.Xpos, Slender.Ypos)
					else
						DrawSpriteScreenXY(197, Slender.Xpos, Slender.Ypos)
					end if
				else
					DrawSpriteScreenXY(54, Slender.Xpos, Slender.Ypos)
				end if

				if FreddySpared > 0	//dead or spared
					DrawSpriteScreenXY(196, Freddy.Xpos, Freddy.Ypos)		
				else	//normal
					DrawSpriteScreenXY(193, Freddy.Xpos, Freddy.Ypos)		
				end if
			end if
		break
		case DELTA_ATTACKSTART_5
		case DELTA_ATTACKING_6
		case DELTA_ATTACKEND_7

			if SlenderSpared > 0
				DrawSpriteScreenXY(198, Slender.Xpos, Slender.Ypos)
			else
				DrawSpriteScreenXY(197, Slender.Xpos, Slender.Ypos)
			end if

			if FreddySpared > 0	//dead or spared
				DrawSpriteScreenXY(196, Freddy.Xpos, Freddy.Ypos)		
			else	//normal
				DrawSpriteScreenXY(193, Freddy.Xpos, Freddy.Ypos)		
			end if

		break		
		case DELTA_BATTLEEND_8
			
			DrawSpriteScreenXY(54, Slender.Xpos, Slender.Ypos)

			switch FreddySpared
			case 1 //dead
				DrawSpriteScreenXY(196, Freddy.Xpos, Freddy.Ypos)		
			break	
			case 2	//alive
				DrawSpriteScreenXY(193, Freddy.Xpos, Freddy.Ypos)		
			break
			end switch
		break			
	end switch
end function


function Delta_TalkingText

	
	temp0 = object.drawX
	temp1 = object.charamount
	while temp1 > 0
	// Get the actual character at the current char pos
	GetTextInfo(object.letter, 0, TEXTINFO_TEXTDATA, Object.Index, ArrayPos0)

	Object.Frame = 107
	
	// Take uppercase letters and turn them into a matching Sprite Frame
	if object.letter > 64
		if object.letter < 91
			Object.Frame  = object.letter
			Object.Frame += 42
		end if
	end if
	
	// Take lowercase letters and turn them into a matching Sprite Frame
	if object.letter > 96
		if object.letter < 123
			Object.Frame  = object.letter
			Object.Frame += 36
		end if
	end if

		//ASCII Table required!
		switch object.letter
			case 32	//Space
				ArrayPos0++
				temp1--
				object.drawX += 0x6
			break
			case 33	//!
				DrawSpriteScreenFX(186, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break		
			case 63	//?
				DrawSpriteScreenFX(185, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break			
			case 39	//'
				DrawSpriteScreenFX(191, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break						
			case 42	//*
				DrawSpriteScreenFX(27, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break
			case 44	//,
				DrawSpriteScreenFX(40, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break		
			case 45	//,
				DrawSpriteScreenFX(210, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break					
			case 46	//.
				DrawSpriteScreenFX(190, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break			
			case 58	//:
				DrawSpriteScreenFX(43, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break		
			case 51	// 3
				DrawSpriteScreenFX(47, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break		
			case 52// 4
				DrawSpriteScreenFX(48, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break							
			case 57	// 9
				DrawSpriteScreenFX(53, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x6
				break	
			case 64	//@	LINE SKIPPER
				object.drawY += 10
			
				temp0 -= 6
				object.drawX = temp0
				

				// Move to the next letter
				ArrayPos0++
				
				// And decrease the remaining letter count, as well
				temp1--
			break
			default
			// Notably, the space character (32) is skipped over here, as it shouldn't draw anything
			

			DrawSpriteScreenFX(Object.Frame, FX_INK, object.drawX, object.drawY)

			// Move to the next letter
			ArrayPos0++
			
			// And decrease the remaining letter count, as well
			temp1--
			
			// Each letter should be spaced 8 pixels apart
			object.drawX += 0x6
			break
		end switch
	loop
end function

function Delta_PlayerHUD
	//Player Bar
	temp0 = screen.xcenter
	temp0 -= 5
	switch stage.playerlistpos
		case 0
			DrawSpriteScreenXY(56, temp0, Options.Ypos)
		break
		case 1
			DrawSpriteScreenXY(57, temp0, Options.Ypos)
		break
		case 2
			DrawSpriteScreenXY(58, temp0, Options.Ypos)
		break
		case 5
			DrawSpriteScreenXY(59, temp0, Options.Ypos)
		break		
		default
			DrawSpriteScreenXY(208, temp0, Options.Ypos)
		break						
	end switch
	//HP Numbers
	temp0 += 4
	Options.Ypos += 2
	if Delta_HP > 0
		DrawNumbers(60, temp0, Options.Ypos, Delta_HP, 3, 4, 0)
	else
		DrawNumbers(60, temp0, Options.Ypos, 0, 3, 4, 0)
	end if

	//HP the rect


	temp1 = screen.xcenter
	temp1 += 11
	temp2 = Options.Ypos
	temp2 -= 36
	temp3 = 40
	temp3 *= Delta_HP
	temp3 /= 90
	temp3 %= 90
	
	switch stage.playerlistpos
		case 0
			DrawRect(temp1, temp2, temp3, 5, color1, color2, color6, 255)
		break
		case 1
			DrawRect(temp1, temp2, temp3, 5, color7, color4, 0, 255)
		break		
		case 2
			DrawRect(temp1, temp2, temp3, 5, color6, 0, color1, 255)
		break		
		case 5
			DrawRect(temp1, temp2, temp3, 5, color6, color2, color5, 255)
		break		
	end switch

	temp0 = screen.xcenter

	switch Options.Selected
	case DELTAMENU_FIGHT_0
		temp0 -= 46
		DrawSpriteScreenXY(70, temp0, Options.Ypos)
	break
	case DELTAMENU_ACT_1
		temp0 -= 27
		DrawSpriteScreenXY(71, temp0, Options.Ypos)
	break
	case DELTAMENU_ITEM_2
		temp0 -= 7
		DrawSpriteScreenXY(72, temp0, Options.Ypos)
	break	
	case DELTAMENU_SPARE_3
		temp0 += 12
		DrawSpriteScreenXY(73, temp0, Options.Ypos)
	break		
	case DELTAMENU_DEFEND_4
		temp0 += 32
		DrawSpriteScreenXY(74, temp0, Options.Ypos)
	break		
	end switch

end function

function Delta_HUD
	temp4 = screen.ycenter
	temp4 += 240
	//Scrolling
	HUD.Slider = temp4
	HUD.Slider -= screen.ycenter
	HUD.Slider /= 8
	HUD.Slider += 24
	temp1 = HUD.Slider
	temp1 -= object.charY
	temp2 = temp1
	Abs(temp2)

	//Make sure it's exactly in the spot
	if temp2 < 6
		if object.charY > HUD.Slider
			object.charY--
		else
			if object.charY < HUD.Slider
				object.charY++
			else
				object.charY = HUD.Slider
			end if
		end if
	else
		temp1 >>= 2
		object.charY += temp1
	end if

	temp4 = object.charY
	temp4 += screen.ycenter
	HUD.Ypos = temp4
	HUD.Ypos -= 2



	temp4 = screen.ycenter
	temp4 += 240
	//Scrolling
	Options.Slider = temp4
	Options.Slider -= screen.ycenter
	Options.Slider /= 8
	Options.Slider += 24
	temp1 = Options.Slider
	temp1 -= Options.AdjustY
	temp2 = temp1
	Abs(temp2)

	//Make sure it's exactly in the spot
	if temp2 < 6
		if Options.AdjustY > Options.Slider
			Options.AdjustY--
		else
			if Options.AdjustY < Options.Slider
				Options.AdjustY++
			else
				Options.AdjustY = Options.Slider
			end if
		end if
	else
		temp1 >>= 2
		Options.AdjustY += temp1
	end if

	temp4 = Options.AdjustY
	temp4 += screen.ycenter
	Options.Ypos = temp4

	if Delta_YourTurn == 1
		Options.AdjustY += 3
	else
		Options.AdjustY += 15
	end if
	

end function

function Delta_BG	
	switch object.state
	case DELTA_WAIT_0
	case DELTA_ALERT_1
	case DELTA_START_2
		object.InkEffect = INK_ALPHA
		DrawRect(0, 0, screen.xsize, screen.ysize, 0x00, 0x00, 0x00, bg.alpha)

		background.timer++
		if background.timer == 2
			//so it always reaches the edge
			bg.scrollback++
			bg.scrollback &= 63
			background.timer = 0
		end if
		temp0 = bg.scrollback
		temp0 -= 64
		while temp0 < screen.ysize
			temp1 = temp0
			temp1 -= screen.xcenter
			while temp1 < screen.xsize
				DrawSpriteScreenFX(45, FX_INK, temp1, temp0)
				temp1 += 64		
			loop
			temp0 += 64
		loop	
			
		//so it always reaches the edge
		bg.scrollfront++
		bg.scrollfront &= 63
		temp0 = bg.scrollfront
		flipsign(temp0)
		while temp0 < screen.ysize
			temp1 = temp0
			temp1 -= screen.xcenter
			while temp1 < screen.xsize
				DrawSpriteScreenFX(44, FX_INK, temp1, temp0)
				temp1 += 64		
			loop
			temp0 += 64
		loop	
	break
	default	//try not to use transparency, so we can use it for other things!
		object.InkEffect = INK_ALPHA
		DrawRect(0, 0, screen.xsize, screen.ysize, 0x00, 0x00, 0x00, 255)

		background.timer++
		if background.timer == 2
			//so it always reaches the edge
			bg.scrollback++
			bg.scrollback &= 63
			background.timer = 0
		end if
		temp0 = bg.scrollback
		temp0 -= 64
		while temp0 < screen.ysize
			temp1 = temp0
			temp1 -= screen.xcenter
			while temp1 < screen.xsize
				DrawSpriteScreenXY(45, temp1, temp0)
				temp1 += 64		
			loop
			temp0 += 64
		loop	
			
		//so it always reaches the edge
		bg.scrollfront++
		bg.scrollfront &= 63
		temp0 = bg.scrollfront
		flipsign(temp0)
		while temp0 < screen.ysize
			temp1 = temp0
			temp1 -= screen.xcenter
			while temp1 < screen.xsize
				DrawSpriteScreenXY(44, temp1, temp0)
				temp1 += 64		
			loop
			temp0 += 64
		loop	
	break
	end switch	
end function



function Delta_TextDrawing

	
	temp0 = object.drawX
	temp1 = object.charamount
	while temp1 > 0
	// Get the actual character at the current char pos
	GetTextInfo(object.letter, 0, TEXTINFO_TEXTDATA, Object.Index, ArrayPos0)

	Object.Frame = 0
	
	// Take uppercase letters and turn them into a matching Sprite Frame
	if object.letter > 64
		if object.letter < 91
			Object.Frame  = object.letter
			Object.Frame -= 64
		end if
	end if
	
	// Take lowercase letters and turn them into a matching Sprite Frame
	if object.letter > 96
		if object.letter < 123
			Object.Frame  = object.letter
			Object.Frame -= 96
		end if
	end if

		//ASCII Table required!
		switch object.letter
			case 33	//!
				DrawSpriteScreenFX(28, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break		
			case 63	//?
				DrawSpriteScreenFX(29, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break			
			case 39	//''
				DrawSpriteScreenFX(42, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break						
			case 42	//*
				DrawSpriteScreenFX(27, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break
			case 44	//,
				DrawSpriteScreenFX(40, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break		
			case 45	//-
				DrawSpriteScreenFX(211, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break				
			case 46	//.
				DrawSpriteScreenFX(41, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break			
			case 58	//:
				DrawSpriteScreenFX(43, FX_INK, object.drawX, object.drawY)
				ArrayPos0++
				temp1--
				object.drawX += 0x8
				break		
			case 48; DrawSpriteScreenFX(160, FX_INK, object.drawX, object.drawY); ArrayPos0++; temp1--; object.drawX += 0x8; break	//0
			case 49; DrawSpriteScreenFX(161, FX_INK, object.drawX, object.drawY); ArrayPos0++; temp1--; object.drawX += 0x8; break	//1		
			case 50; DrawSpriteScreenFX(162, FX_INK, object.drawX, object.drawY); ArrayPos0++; temp1--; object.drawX += 0x8; break	//2
			case 51; DrawSpriteScreenFX(163, FX_INK, object.drawX, object.drawY); ArrayPos0++; temp1--; object.drawX += 0x8; break	//3				
			case 64	//@	LINE SKIPPER
				object.drawY += 16
			
				temp0 -= 8
				object.drawX = temp0
				

				// Move to the next letter
				ArrayPos0++
				
				// And decrease the remaining letter count, as well
				temp1--
			break
			default
			// Notably, the space character (32) is skipped over here, as it shouldn't draw anything
			

			DrawSpriteScreenFX(Object.Frame, FX_INK, object.drawX, object.drawY)

			// Move to the next letter
			ArrayPos0++
			
			// And decrease the remaining letter count, as well
			temp1--
			
			// Each letter should be spaced 8 pixels apart
			object.drawX += 0x8
			break
		end switch
	loop
end function

//if being stupid was a job

event ObjectMain
	Callfunction(AutoMobile)
	switch object.state
		case DELTA_WAIT_0
			//Wait for action
			//Probably going to be called in UFO Object (Slenderman)
			bg.alpha = 0
			object.alpha = 0
			background.timer = 0
			object.timer++
			if object.timer == 50
				playsfx(SfxName[BattleAlert], 0)
				object.state++
				object.timer = 0
			end if
		break
		case DELTA_ALERT_1	
			//Set Positions!
			Player.Xpos = -32
			Slender.Xpos = screen.xsize
			Slender.Ypos = screen.ycenter
			Freddy.Xpos = screen.xsize
			temp2 = screen.ycenter
			temp2 += 16
			Freddy.Ypos = temp2
			object.charY = 150
			Options.AdjustY = 150
			object.timer++
			
			if object.timer == 60
				playsfx(SfxName[BattleStart], 0)
				object.state++	
				object.timer = 0
			end if
		break
		case DELTA_START_2
			//fade in things
			CallFunction(Delta_HUD)
			if bg.alpha < 255
				bg.alpha += 8
			else
				bg.alpha = 255
			end if
			

			if object.alpha < 255
				object.alpha += 8
			else
				object.alpha = 255
			end if	

			temp0 = screen.xcenter
			temp0 -= 135
			
			if player.xpos < temp0
				temp1 = 32
				temp1 >>= 2
				temp2++
				temp2 += temp1
				temp2 /= 4
				Player.Xpos+= temp2
			end if

			temp2 = screen.xcenter
			temp2 += 105
			if Slender.Xpos > temp2
				temp1 = -32
				temp1 >>= 2
				temp2++
				temp2 += temp1
				temp2 /= 28
				Slender.Xpos-= temp2
			endif

			if object.alpha == 255
				Delta_YourTurn = 0
				object.rotation = 0
				object.scale = 0
				object.charamount = 0				
				act.selection = -1
				item.selection = -1
				Delta_TextProgression = 0
				Delta_IsTalking = -1
				object.state = DELTA_DIALOGUE_4
			end if
		break
		case DELTA_BATTLEIDLE_3
			CallFunction(Delta_HUD)

			StopSfx(SfxName[Har1])	
			StopSfx(SfxName[SlenderTalk])	
		
			// private alias 1  : DELTAOPT_FIGHT_PICKTARGET_1
			// private alias 2  : DELTAOPT_FIGHT_ATTACKING_2

			// private alias 3  : DELTAOPT_ACT_PICKTARGET_5
			// private alias 4  : DELTAOPT_ACT_CHOOSEACT_6

			// private alias 5  : DELTAOPT_ITEM_CHOOSEITEM_5
			// private alias 6  : DELTAOPT_ITEM_USEITEM

			// private alias 7  : DELTAOPT_SPARE_CHOOSETARGET_9
			// private alias 8  : DELTAOPT_SPARE_MERCYCHECK_8

			switch Options.State
			case DELTAOPT_CHOOSING_0
				Act.Selection = -1
				Item.Selection = -1
				if inputPress.right == 1
					PlaySfx(SfxName[Score Add], false)		
					if Options.Selected < 4
						Options.Selected++
					else
						Options.Selected = 0
					end if
				end if

				if inputPress.left == 1
					PlaySfx(SfxName[Score Add], false)		
					if Options.Selected > 0
						Options.Selected--
					else
						Options.Selected = 4
					end if
				end if	

				//draw the text
				GetTextInfo(temp0, 0, TEXTINFO_TEXTSIZE, Object.Index, 0)
				if object.charamount == temp0
		
				else
					object.charamount++
					PlaySfx(SfxName[Text], false)				
				end if	

				//Option States
				// private alias 0  : DELTAOPT_CHOOSING_0

				// private alias 1  : DELTAOPT_FIGHT_PICKTARGET_1
				// private alias 2  : DELTAOPT_FIGHT_ATTACKING_2

				// private alias 3  : DELTAOPT_ACT_PICKTARGET_5
				// private alias 4  : DELTAOPT_ACT_CHOOSEACT_6

				// private alias 5  : DELTAOPT_ITEM_CHOOSEITEM_5
				// private alias 6  : DELTAOPT_ITEM_USEITEM

				// private alias 7  : DELTAOPT_SPARE_CHOOSETARGET_9
				// private alias 8  : DELTAOPT_SPARE_MERCYCHECK_8

				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult
				if temp0 == 1
					playsfx(SfxName[Lamp Post], 0)
					switch Options.Selected
					case DELTAMENU_FIGHT_0
						CheckEqual(SlenderSpared, 0)
						temp2 = checkResult
						CheckEqual(FreddySpared, 0)
						temp2 &= checkResult
						if temp2 == 1
							object.index = 2
						end if

						if SlenderSpared > 0
							object.index = 17
						end if

						if FreddySpared > 0
							object.index = 16
						end if


						CheckEqual(SlenderSpared, 0)
						temp2 = checkResult
						CheckEqual(FreddySpared, 0)
						temp2 &= checkResult
						if temp2 == 1
							object.charamount = 22
						else	
							if SlenderSpared > 0	
								object.charamount = 8	//freddy amount
							else
								object.charamount = 12	//slender amount
							end if
						end if
						Options.State = DELTAOPT_FIGHT_PICKTARGET_1
					break
					case DELTAMENU_ACT_1
						CheckEqual(SlenderSpared, 0)
						temp2 = checkResult
						CheckEqual(FreddySpared, 0)
						temp2 &= checkResult
						if temp2 == 1
							object.index = 2
						end if

						if SlenderSpared > 0
							object.index = 17
						end if

						if FreddySpared > 0
							object.index = 16
						end if
						CheckEqual(SlenderSpared, 0)
						temp2 = checkResult
						CheckEqual(FreddySpared, 0)
						temp2 &= checkResult
						if temp2 == 1
							object.charamount = 22
						else	
							if SlenderSpared > 0	
								object.charamount = 8	//freddy amount
							else
								object.charamount = 12	//slender amount
							end if
						end if
						Options.State = DELTAOPT_ACT_PICKTARGET_5				
					break
					case DELTAMENU_ITEM_2
						if Delta_RingsUsed < 3
							object.index = 7
							switch Delta_RingsUsed
							case 0
								object.charamount = 32
							break
							case 1
								object.charamount = 24
							break						
							case 2
								object.charamount = 12
							break
							default
								object.charamount = 0
							break
							end switch
							Item.Selection = 0	
							Options.State = DELTAOPT_ITEM_CHOOSEITEM_7
						else
							PlaySfx(SfxName[Skidding], false)		
						end if
					break	
					case DELTAMENU_SPARE_3
						CheckEqual(SlenderSpared, 0)
						temp2 = checkResult
						CheckEqual(FreddySpared, 0)
						temp2 &= checkResult
						if temp2 == 1
							object.index = 2
						end if

						if SlenderSpared > 0
							object.index = 17
						end if

						if FreddySpared > 0
							object.index = 16
						end if
						CheckEqual(SlenderSpared, 0)
						temp2 = checkResult
						CheckEqual(FreddySpared, 0)
						temp2 &= checkResult
						if temp2 == 1
							object.charamount = 22
						else	
							if SlenderSpared > 0	
								object.charamount = 8	//freddy amount
							else
								object.charamount = 12	//slender amount
							end if
						end if
						Options.State = DELTAOPT_SPARE_CHOOSETARGET_9
					break		
					case DELTAMENU_DEFEND_4
						if Delta_TP < 100
							Delta_TP += 8
						else
							Delta_TP = 100
						end if


							Delta_Defending = 1
							Delta_YourTurn = 0
							object.rotation = 0
							object.scale = 0
							object.charamount = 0				
							object.AnimationTimer = 200
							object.animation = 4
							object.state = DELTA_DIALOGUE_4
						
					break		
					end switch
				end if
			break
			//they basically work the same, so why not just mix em
			case DELTAOPT_FIGHT_PICKTARGET_1
			case DELTAOPT_ACT_PICKTARGET_5
			case DELTAOPT_SPARE_CHOOSETARGET_9

				//0 = Alive, 1 = Dead, 2 = Spared

				// public value SlenderSpared = 0;
				// public value FreddySpared = 0;
				CheckEqual(SlenderSpared, 0)
				temp0 = checkResult
				CheckEqual(FreddySpared, 0)
				temp0 &= checkResult
				if temp0 == 1
					if inputpress.up == 1
						PlaySfx(SfxName[Score Add], false)		
						Delta_AttackTarget = 0	//Slenderman
					end if
					if inputpress.down == 1
						PlaySfx(SfxName[Score Add], false)		
						Delta_AttackTarget = 1	//Freddy
					end if
				else
					if SlenderSpared > 0
						Delta_AttackTarget = 1	//Freddy
					end if

					if FreddySpared > 0
						Delta_AttackTarget = 0	//Slenderman
					end if
				end if

				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult
				if temp0 == 1
					playsfx(SfxName[Lamp Post], 0)
					switch Options.State
					case DELTAOPT_FIGHT_PICKTARGET_1
						object.index = -1
						object.charamount = 0
						Menu.AttackBar = screen.xsize
						Options.State = DELTAOPT_FIGHT_ATTACKING_2
					break
					case DELTAOPT_ACT_PICKTARGET_5
						if Delta_AttackTarget == 0
							if Delta_ActFlirted == 0
								object.index = 3
							else
								object.index = 4
							end if
						else
							if Delta_ActFlirted == 0
								object.index = 12
							else
								object.index = 13
							end if
						end if
						object.charamount = -1				
						Act.Selection = 0	
						Options.State = DELTAOPT_ACT_CHOOSEACT_6
					break
					case DELTAOPT_SPARE_CHOOSETARGET_9
						switch Delta_AttackTarget
						case 0
							if Delta_SlenderMercy >= 100	//spared
								object.index = -1
							else
								object.index = 10
							end if
						break
						case 1
							if Delta_FreddyMercy >= 100	//spared
								object.index = -1
							else
								object.index = 18
							end if
						break						
						end switch
						object.charamount = -1
						Delta_TextProgression = 99
						Options.State = DELTAOPT_SPARE_MERCYCHECK_10
					break					
					end switch
				end if

				if inputpress.buttonB == 1
					if Delta_BottomText < 5
						switch Delta_BottomText
							case 0
								object.index = 1				
							break
							case 24	//out of ideasa ig lol
								object.index = 24
							break								
							default
								temp0 = 19
								temp0 += Delta_BottomText
								object.index = temp0
							break	
						end switch
					else
						object.index = 23
					end if
					object.charamount = 0
					Options.State = 0
				end if
				break
			//Here it comes!
			case DELTAOPT_FIGHT_ATTACKING_2
				Menu.AttackBar -= 3
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult
				if temp0 == 1
					Options.State = DELTAOPT_FIGHT_RESULTS_3
				end if
				
				//at least try man
				if Menu.AttackBar < 0
					Options.State = DELTAOPT_FIGHT_RESULTS_3
				end if
			break	
			case DELTAOPT_FIGHT_RESULTS_3
				//Right Limit
				Menu.AttackRadius = screen.xcenter
				Menu.AttackRadius -= 36

				if Menu.AttackBar > Menu.AttackRadius
					Menu.AttackDamage = 0	//miss
				else
					//Left Limit
					Menu.AttackLowerR = 0
					CheckLower(Menu.AttackBar, Menu.AttackRadius)
					temp0 = checkResult
					CheckGreater(Menu.AttackBar, Menu.AttackLowerR)
					temp0 |= checkResult					
					if temp0 == 1
						Menu.AttackDamage = 0	//dude
					end if

					Menu.AttackLowerR = screen.xcenter
					Menu.AttackLowerR -= 92	
					CheckGreater(Menu.AttackBar, Menu.AttackLowerR)
					temp0 = checkResult					
					if temp0 == 1
						playsfx(SfxName[Slash], 0)
						Menu.AttackDamage = 10	//dude
					end if

					Menu.AttackLowerR += 6	
					CheckGreater(Menu.AttackBar, Menu.AttackLowerR)
					temp0 = checkResult					
					if temp0 == 1
						playsfx(SfxName[Slash], 0)
						Menu.AttackDamage = 8	//dude
					end if

					Menu.AttackLowerR += 5	
					CheckGreater(Menu.AttackBar, Menu.AttackLowerR)
					temp0 = checkResult					
					if temp0 == 1
						playsfx(SfxName[Slash], 0)
						Menu.AttackDamage = 6	//dude
					end if

					Menu.AttackLowerR += 10	
					CheckGreater(Menu.AttackBar, Menu.AttackLowerR)
					temp0 = checkResult					
					if temp0 == 1
						playsfx(SfxName[Slash], 0)
						Menu.AttackDamage = 4	//dude
					end if

					Menu.AttackLowerR += 12	
					CheckGreater(Menu.AttackBar, Menu.AttackLowerR)
					temp0 = checkResult					
					if temp0 == 1
						playsfx(SfxName[Slash], 0)
						Menu.AttackDamage = 2	//dude
					end if


				end if
				

				if menu.AttackDamage > 0
					object.animationtimer = 5
				end if

				Options.State = DELTAOPT_FIGHT_EFFECTS_4
			break
			case DELTAOPT_FIGHT_EFFECTS_4
				Object.timer++

				if object.timer == 30
					if menu.AttackDamage > 0
						playsfx(SfxName[Attacked], 0)
						if Delta_AttackTarget == DELTATARGET_SLENDERMAN_0
							Delta_SlenderHP -= Menu.AttackDamage
						else
							Delta_FreddyHP -= Menu.AttackDamage
						end if
						Slender.AnimTimer = 30
					end if
				end if

				if object.timer > 30
					if menu.AttackDamage > 0
						Object.TableTimer++
						GetTableValue(temp2, object.TableContainer, SlenderBounce)
						if Object.TableTimer >= 3
							object.TableContainer++
							if object.TableContainer > 14
								object.TableContainer = 14
							end if	
							Object.TableTimer = 0
						end if	

						// private alias 0  : DELTATARGET_SLENDERMAN_0
						// private alias 1  : DELTATARGET_FREDDY_1

						if Delta_AttackTarget == DELTATARGET_SLENDERMAN_0
							Slender.XPos += temp2
						else
							Freddy.XPos += temp2
						end if
					end if
				end if

				if Delta_SlenderHP <= 0
					SlenderSpared = 1
				end if

				if Delta_FreddyHP <= 0
					FreddySpared = 1
				end if


				CheckGreater(SlenderSpared, 0)
				temp1 = checkResult
				CheckGreater(FreddySpared, 0)
				temp1 &= checkResult				
				if temp1 == 1	//not dead!
					music.volume -= 2
					if music.volume == 0
						Delta_YourTurn = 0
						Delta_IsTalking = 1
						object.charamount = -1
						Delta_TextProgression = 99						
						object.state = DELTA_BATTLEEND_8
						object.timer = 0
					end if
				else	//both of them dead!
					music.volume = 100
					if object.timer > 100
						Delta_YourTurn = 0
						object.rotation = 0
						object.scale = 0
						object.charamount = 0
						object.animationtimer = 0
						object.state = DELTA_DIALOGUE_4
						object.TableContainer = 0
						Object.TableTimer = 0
						object.timer = 0
					end if
				end if
			break
			case DELTAOPT_ACT_CHOOSEACT_6
				if Delta_ActFlirted == 0
					if inputpress.right == 1
						PlaySfx(SfxName[Score Add], false)		
						if act.Selection < 2
							Act.Selection++	
						else
							Act.Selection = 0
						end if
					end if

					if inputpress.left == 1
						PlaySfx(SfxName[Score Add], false)		
						if act.Selection > 0
							Act.Selection--	
						else
							Act.Selection = 2
						end if
					end if	

					if inputpress.up == 1
						PlaySfx(SfxName[Score Add], false)		
						Act.Selection = 0
					end if	

					if inputpress.down == 1
						PlaySfx(SfxName[Score Add], false)		
						Act.Selection = 2
					end if								
				else
					if inputpress.right == 1
						PlaySfx(SfxName[Score Add], false)		
						if act.Selection < 2
							Act.Selection = 2
						else
							Act.Selection = 0
						end if
					end if

					if inputpress.left == 1
						PlaySfx(SfxName[Score Add], false)		
						if act.Selection > 0
							Act.Selection = 0
						else
							Act.Selection = 2
						end if
					end if		

					if inputpress.up == 1
						PlaySfx(SfxName[Score Add], false)		
						Act.Selection = 0
					end if	

					if inputpress.down == 1
						PlaySfx(SfxName[Score Add], false)		
						Act.Selection = 2
					end if										
				end if	

				GetTextInfo(temp0, 0, TEXTINFO_TEXTSIZE, Object.Index, 0)
				object.charamount = temp0

				if inputpress.buttonB == 1
					Act.Selection = -1 

					CheckEqual(SlenderSpared, 0)
					temp2 = checkResult
					CheckEqual(FreddySpared, 0)
					temp2 &= checkResult
					if temp2 == 1
						object.index = 2
					end if

					if SlenderSpared > 0
						object.index = 17
					end if

					if FreddySpared > 0
						object.index = 16
					end if
					CheckEqual(SlenderSpared, 0)
					temp2 = checkResult
					CheckEqual(FreddySpared, 0)
					temp2 &= checkResult
					if temp2 == 1
						object.charamount = 22
					else	
						if SlenderSpared > 0	
							object.charamount = 10	//freddy amount
						else
							object.charamount = 12	//slender amount
						end if
					end if


					Options.State = DELTAOPT_ACT_PICKTARGET_5
				end if

				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult
				if temp0 == 1
					Delta_YourTurn = 0
					object.rotation = 0
					object.scale = 0
					object.charamount = 0				
					object.AnimationTimer = 200
					object.animation = 1
					object.state = DELTA_DIALOGUE_4
				end if


			break
			case DELTAOPT_ITEM_CHOOSEITEM_7
				switch Delta_RingsUsed
				case 0
					if inputpress.right == 1
						PlaySfx(SfxName[Score Add], false)		
						if Item.Selection < 2
							Item.Selection++	
						else
							Item.Selection = 0
						end if
					end if

					if inputpress.left == 1
						PlaySfx(SfxName[Score Add], false)		
						if Item.Selection > 0
							Item.Selection--	
						else
							Item.Selection = 2
						end if
					end if	

					if inputpress.up == 1
						PlaySfx(SfxName[Score Add], false)		
						Item.Selection = 0
					end if	

					if inputpress.down == 1
						PlaySfx(SfxName[Score Add], false)		
						Item.Selection = 2
					end if	
				break
				case 1
					if inputpress.right == 1
						PlaySfx(SfxName[Score Add], false)		
						if Item.Selection < 1
							Item.Selection++	
						else
							Item.Selection = 0
						end if
					end if

					if inputpress.left == 1
						PlaySfx(SfxName[Score Add], false)		
						if Item.Selection > 0
							Item.Selection--	
						else
							Item.Selection = 1
						end if
					end if	
				break		
				case 2
					Item.Selection = 0
				break		
				end switch
			
				if inputpress.buttonB == 1
					if Delta_BottomText < 5
						switch Delta_BottomText
							case 0
								object.index = 1				
							break
							case 24	//out of ideasa ig lol
								object.index = 24
							break								
							default
								temp0 = 19
								temp0 += Delta_BottomText
								object.index = temp0
							break	
						end switch
					else
						object.index = 23
					end if
					Item.Selection = -1
					object.charamount = 0
					Options.State = 0
				end if

				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					Delta_YourTurn = 0
					object.rotation = 0
					object.scale = 0
					object.charamount = 0				
					object.AnimationTimer = 200
					object.animation = 3
					object.state = DELTA_DIALOGUE_4
				end if


			break		
			case DELTAOPT_SPARE_MERCYCHECK_10
				CheckGreater(SlenderSpared, 0)
				temp1 = checkResult
				CheckGreater(FreddySpared, 0)
				temp1 &= checkResult	
				if temp1 == 0	
					music.volume = 100

				if Delta_AttackTarget == 0
					if Delta_SlenderMercy < 100
						//draw the text
						GetTextInfo(temp0, 0, TEXTINFO_TEXTSIZE, Object.Index, 0)
						if object.charamount == temp0
				
						else
							object.charamount++
							PlaySfx(SfxName[Text], false)				
						end if	

						CheckEqual(inputpress.start, 1)
						temp0 = checkResult
						CheckEqual(inputpress.buttonA, 1)
						temp0 |= checkResult				
						if temp0 == 1
							Delta_YourTurn = 0
							object.rotation = 0
							object.scale = 0
							object.charamount = 0				
							object.state = DELTA_DIALOGUE_4
						end if
					else
						SlenderSpared = 2
						Delta_YourTurn = 0
						object.rotation = 0
						object.scale = 0
						object.charamount = 0				
						object.state = DELTA_DIALOGUE_4
					end if
				else
					if Delta_FreddyMercy < 100
						//draw the text
						GetTextInfo(temp0, 0, TEXTINFO_TEXTSIZE, Object.Index, 0)
						if object.charamount == temp0
				
						else
							object.charamount++
							PlaySfx(SfxName[Text], false)				
						end if	

						CheckEqual(inputpress.start, 1)
						temp0 = checkResult
						CheckEqual(inputpress.buttonA, 1)
						temp0 |= checkResult				
						if temp0 == 1
							Delta_YourTurn = 0
							object.rotation = 0
							object.scale = 0
							object.charamount = 0				
							object.state = DELTA_DIALOGUE_4
						end if
					else
						FreddySpared = 2
						Delta_YourTurn = 0
						object.rotation = 0
						object.scale = 0
						object.charamount = 0				
						object.state = DELTA_DIALOGUE_4
					end if
				end if
			else	//both greater end batle
				music.volume -= 2
				if music.volume == 0
					Delta_YourTurn = 0
					Delta_IsTalking = 1
					object.charamount = 0		
					object.state = DELTA_BATTLEEND_8
				end if
			end if
		break	
		end switch
	break
	case DELTA_DIALOGUE_4
		CallFunction(Delta_HUD)
		Options.State = -1

		CheckGreater(SlenderSpared, 0)
		temp2 = checkResult
		CheckGreater(FreddySpared, 0)
		temp2 &= checkResult	
		if temp2 == 1
			music.volume -= 2
			if music.volume == 0
				Delta_YourTurn = 0
				Delta_IsTalking = 1
				object.charamount = 0		
				object.state = DELTA_BATTLEEND_8
			end if
		else

			CheckGreater(act.selection, -1)
			temp1 = checkResult
			CheckGreater(item.selection, -1)
			temp1 |= checkResult			
			if temp1 == 1
				if act.Selection > -1
					switch act.Selection
					case 0	//Check
						if Delta_AttackTarget == 0	//slenderman pages
							Object.index = 5
						else
							Object.index = 14
						end if
						CheckEqual(inputpress.start, 1)
						temp0 = checkResult
						CheckEqual(inputpress.buttonA, 1)
						temp0 |= checkResult				
						if temp0 == 1
							object.charamount = 0
							Act.Selection = -1
							object.AnimationTimer = 0
						//	Text.Proceed = 1
						end if	
					break
					case 1	//Flirt
						music.volume = 0
						Object.index = -1
						object.timer++
						if object.timer == 400
							Delta_ActFlirted = 1
							object.charamount = 0
							Act.Selection = -1
							object.AnimationTimer = 0
							music.volume = 100
							object.timer = 0
						end if
					break
					case 2	//Collect
						if Delta_AttackTarget == 0	//slenderman pages
							Object.index = 6
							Delta_Attacker = 0
							Object.ActedMercy = 1
						else	//freddy pizza
							Object.index = 15
							Delta_Attacker = 1
							Object.ActedMercy = 1
						end if
						CheckEqual(inputpress.start, 1)
						temp0 = checkResult
						CheckEqual(inputpress.buttonA, 1)
						temp0 |= checkResult				
						if temp0 == 1
							Delta_BecomeGreen = 1
							object.charamount = 0
							Act.Selection = -1
							object.AnimationTimer = 0
						//	Text.Proceed = 1
						end if	
					break		
					end switch
				end if

				if Item.Selection > -1
					Object.index = 9
					CheckEqual(inputpress.start, 1)
					temp0 = checkResult
					CheckEqual(inputpress.buttonA, 1)
					temp0 |= checkResult				
					if temp0 == 1

						if ringPan == 0
							PlaySfx(SfxName[Ring L], 0)
							SetSfxAttributes(SfxName[Ring L], -1, -100)
							ringPan = 1
						else
							PlaySfx(SfxName[Ring R], 0)
							SetSfxAttributes(SfxName[Ring R], -1, 100)
							ringPan = 0
						end if

						Delta_HP += 20

						if Delta_HP > 90
							Delta_HP = 90
						end if

						Delta_RingsUsed++
						object.charamount = 0
						Item.Selection = -1
						object.AnimationTimer = 0
					end if	
				end if
			else

				if stage.playerlistpos <= 5
					// So...
					// You want to@ battle again@  huh?
					// Well this@ time...
					// I brought a@ friend!
					// Yo
					// Im Freddy
					switch Delta_TextProgression
						case 0	// So...
							Delta_IsTalking = 3	
							Object.index = 50
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if
						break
						case 1	// You want to@ battle again@  huh?
							Delta_IsTalking = 3	
							Object.index = 51
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = 0
								Delta_TextProgression++
								Object.index++
							end if				
						break
						case 2	// Well this@ time...
							Delta_IsTalking = 3	//Slender
							Object.index = 52
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = 0
								Delta_TextProgression++
								Object.index++
							end if				
						break	
						case 3	// I brought a@ friend!
							Delta_IsTalking = 3	//Slender
							Object.index = 53
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = 0
								Delta_IsTalking = -1
								Delta_TextProgression++
								Object.index++
							end if				
						break	
						case 4	// im freddy

							temp2 = screen.xcenter
							temp2 += 115
							if Freddy.Xpos > temp2
								Slender.Ypos-= 4
								temp1 = -32
								temp1 >>= 2
								temp2++
								temp2 += temp1
								temp2 /= 32
								Freddy.Xpos-= temp2
								
							else
								Delta_IsTalking = 2	//freddy
								Object.index = 54
								CheckEqual(inputpress.start, 1)
								temp0 = checkResult
								CheckEqual(inputpress.buttonA, 1)
								temp0 |= checkResult				
								if temp0 == 1
									object.charamount = -1
									Delta_TextProgression++
									Object.index++
								end if		
							endif		
						break			
						case 5	//from fnaf!
							Delta_IsTalking = 2	//freddy
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if				
						break			
						case 6	//can you beat us both?
							Delta_IsTalking = 1	//Slender
							Object.index = 56
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if				
						break	
						case 7
							Delta_IsTalking = -1
							object.charamount = 0
							Delta_TextProgression++
							Text.Proceed = 2
						break
					end switch

					if Delta_TextProgression > 7
						CheckEqual(SlenderSpared, 0)
						temp3 = checkResult
						CheckEqual(FreddySpared, 0)
						temp3 &= checkResult
						if temp3 == 1			
							Callfunction(Delta_AliveDialogue)
						else
							Delta_IsTalking = -1
							object.charamount = 0
							Text.Proceed = 1
						end if
					end if
				else 
					switch Delta_TextProgression
						case 0	// So...
							Delta_IsTalking = 3	
							Object.index = 161
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if
						break
						case 1	// So...
							Delta_IsTalking = 3	
							Object.index = 162
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if
						break				
						case 2	// So...
							Delta_IsTalking = 3	
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if
						break			
						case 3	// So...
							Delta_IsTalking = 3	
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if
						break					
						case 4	// So...
							Delta_IsTalking = 3	
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
							end if
						break	
						case 5	// So...
							Delta_IsTalking = 3	
							CheckEqual(inputpress.start, 1)
							temp0 = checkResult
							CheckEqual(inputpress.buttonA, 1)
							temp0 |= checkResult				
							if temp0 == 1
								object.charamount = -1
								Delta_TextProgression++
								Object.index++
								PlaySfx(SfxName[sans], 0)
								Text.Proceed = 3
							end if
						break																						
					end switch
				end if
			end if

		
			//draw the text
			GetTextInfo(temp0, 0, TEXTINFO_TEXTSIZE, Object.Index, 0)
			if object.charamount == temp0

			else
				object.charamount++
				switch Delta_IsTalking
					case 1
					case 3

						CheckGreater(act.selection, -1)
						temp1 = checkResult
						CheckGreater(item.selection, -1)
						temp1 |= checkResult			
						if temp1 == 1
							PlaySfx(SfxName[Text], 0)
						else
							PlaySfx(SfxName[SlenderTalk], false)		
						end if
					break
					case 2

						CheckGreater(act.selection, -1)
						temp1 = checkResult
						CheckGreater(item.selection, -1)
						temp1 |= checkResult			
						if temp1 == 1
							PlaySfx(SfxName[Text], 0)
						else
							PlaySfx(SfxName[Har1], false)		
						end if

						
					break
					default
						PlaySfx(SfxName[Text], false)			
					break
				end switch	
			end if		

			if object.charamount == 0
				StopSfx(SfxName[Text])	
				StopSfx(SfxName[Har1])	
				StopSfx(SfxName[SlenderTalk])	
			end if
	
			if Text.Proceed == 3
				object.timer++
				if object.timer == 100
					Delta_Activate = 0	//its over
					PlaySfx(SfxName[sans], 0)
					stage.activeList = BONUS_STAGE
					stage.listPos = StageName[B - SLENDERMENU]
					LoadStage()	
				end if
			end if
	
			if Text.Proceed == 2
				StopSfx(SfxName[Har1])	
				StopSfx(SfxName[SlenderTalk])				
				Text.Proceed = 0
				Delta_IsTalking = -1
				Delta_AttackOrder = 0
				Delta_YourTurn = 1
				Delta_Defending = 0
				if Delta_BottomText < 5
					switch Delta_BottomText
						case 0
							object.index = 1				
						break
						case 24	//out of ideasa ig lol
							object.index = 24
						break								
						default
							temp0 = 19
							temp0 += Delta_BottomText
							object.index = temp0
						break	
					end switch
				else
					object.index = 23
				end if
				Delta_BecomeGreen = 0
				Object.AnimationTimer = 0
				Options.State = 0
				PlayMusic(11)
				object.state = DELTA_BATTLEIDLE_3
			end if

			if Text.Proceed == 1
				object.animationtimer = 0
				StopSfx(SfxName[Text])	
				StopSfx(SfxName[Har1])	
				StopSfx(SfxName[SlenderTalk])	
				object.state++
				Text.Proceed = 0

				//yes im so serious
				temp1 = screen.xcenter
				temp1 *= 0x100
				temp2 = Screen.ycenter
				temp2 *= 0x100
				
				CreateTempObject(TypeName[Delta Bounds], 0, temp1, temp2)
				object[tempObjectPos].drawOrder = 6		

				// // State aliases
				// private alias 0  : DELTAATTACKS_PROJECTILE_0
				// private alias 1  : DELTAATTACKS_PROJECTILE_MERCY_1
				// private alias 2  : DELTAATTACKS_THUNDERALERT_2
				// private alias 3  : DELTAATTACKS_FASTTHUNDER_3
				// private alias 4  : DELTAATTACKS_TREE_UP_4
				// private alias 5  : DELTAATTACKS_TREE_DOWN_5
				// private alias 6  : DELTAATTACKS_TREE_RIGHT_6
				// private alias 7  : DELTAATTACKS_TREE_LEFT_7

				//didnt use Mercy, which sets target by default
				if Delta_AttackOrder < 6
					if Object.ActedMercy == 0
						switch Delta_AttackOrder
							case 0
								Delta_Attacker = 0
							break
							case 1
								Delta_Attacker = 1
							break			
							case 2
								Delta_Attacker = 1
							break
							case 3
								Delta_Attacker = 0
							break
							case 5
								Delta_Attacker = 1
							break																													
						end switch
					end if
				else
					if Object.ActedMercy == 0
						//if their both alive randomly choose
						CheckEqual(SlenderSpared, 0)
						temp2 = checkResult
						CheckEqual(FreddySpared, 0)
						temp2 &= checkResult
						if temp2 == 1
							rand(temp4, 2)
							if temp4 == 0
								Delta_Attacker = 0
							else		
								Delta_Attacker = 1
							end if
						else	//if you killed  or spared one of them
							if SlenderSpared > 0
								Delta_Attacker = 1
							else
								if FreddySpared > 0
									Delta_Attacker = 0
								end if
							end if
						end if
					end if
				end if

				if Delta_AttackOrder < 6
					switch Delta_AttackOrder
						case 0
						case 1
							Attack.Property = 0
							Delta_AttackHardMode = 0
						break
						case 2
							Attack.Property = 2
							Delta_AttackHardMode = 1
						break				
						case 3
							Attack.Property = 3
							Delta_AttackHardMode = 0
						break		
						case 4
							Attack.Property = 4
							Delta_AttackHardMode = 0
						break		
						case 5
							Attack.Property = 5
							Delta_AttackHardMode = 0
						break		
					end switch
				else
					if Delta_Attacker == 0
						rand(temp4, 6)	//6 = 0, 1, 2, 3, 4, 5
						if temp4 == 3		
							temp4 = 6
						end if
					else
						rand(temp4, 5)	//6 = 0, 1, 2, 3, 4, 5

						if temp4 == 1		
							temp4 = 5
						end if
					end if
					rand(temp3, 10)



					Attack.Property = temp4
					if temp3 >= 5
						Delta_AttackHardMode = 1
					else
						Delta_AttackHardMode = 0
					end if
				end if

				temp1 = screen.xcenter
				temp1 *= 0x19000
				temp2 = Screen.ycenter
				temp2 *= 0x10000
				
				CreateTempObject(TypeName[Freddy Attacks], Attack.Property, temp1, temp2)
				object[tempObjectPos].drawOrder = 6		
				switch object[tempObjectPos].propertyValue
					case 4
					case 5
					case 6
					case 7
						object[tempObjectPos].value3 = 75	
					break
				end switch		
				Object.AttackTimer = 800

				temp0 = Slender.xpos
				temp0 *= 0x20000
				CreateTempObject(TypeName[Delta Soul], 0, temp0, Screen.ycenter)
				object[tempObjectPos].drawOrder = 6		
				object.timer = 0	
			end if
		end if
	break
	case DELTA_ATTACKSTART_5
		CallFunction(Delta_HUD)
		Options.State = -1
		if object.scale == 512
			object.state = DELTA_ATTACKING_6
		end if
	break
	case DELTA_ATTACKING_6
		CallFunction(Delta_HUD)

		foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)	
			//Top
		//	BoxCollisionTest(C_BOX, object.entityPos, 175, 66, 173, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			//Bottom
			temp0 = screen.xcenter
			temp0 -= 38
			temp1 = screen.xcenter
			temp1 += 38			
			BoxCollisionTest(C_BOX, object.entityPos, temp0, 139, temp1, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			BoxCollisionTest(C_TOUCH, object.entityPos, temp0, 66, temp1, 68, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			if checkResult == 1
				if inputdown.down == 1

				else
					object[currentPlayer].yvel = 0
				end if
			end if			


			//Left
			temp0 = screen.xcenter
			temp0 -= 38
			temp1 = screen.xcenter
			temp1 -= 36	
			BoxCollisionTest(C_TOUCH, object.entityPos, temp0, 66, temp1, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			if checkResult == 1
				if inputdown.right == 1

				else
					object[currentPlayer].speed = 0
					object[currentPlayer].xvel = 0
				end if
			end if


			
			//Right
			temp0 = screen.xcenter
			temp0 += 35
			temp1 = screen.xcenter
			temp1 += 33	
			BoxCollisionTest(C_TOUCH, object.entityPos, temp0, 66, temp1, 141, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			if checkResult == 1
				if inputdown.left == 1

				else
					object[currentPlayer].speed = 0
					object[currentPlayer].xvel = 0
				end if
			end if
			
		next

		 if Object.AttackTimer > 0
		 	Object.AttackTimer--
		 end if

		if Object.AttackTimer <= 0
			object[tempObjectPos].type = TypeName[Blank Object]
			ResetObjectEntity(currentPlayer, TypeName[Blank Object], 0, object.xpos, object.ypos)
			object.state = DELTA_ATTACKEND_7
			object.rotation = 512
			object.scale = 512
		end if
	break
	case DELTA_ATTACKEND_7
		CallFunction(Delta_HUD)
		Options.State = 0

		
	
		object.rotation -= 16
	
		object.scale -= 16

		if object.scale == 0
			Delta_IsTalking = -1
			Delta_AttackOrder++
			Delta_YourTurn = 1
			Delta_Defending = 0
			if Delta_BottomText < 5
				Delta_BottomText++
				switch Delta_BottomText
					case 0
						object.index = 1				
					break
					case 24	//out of ideasa ig lol
						object.index = 24
					break								
					default
						temp0 = 19
						temp0 += Delta_BottomText
						object.index = temp0
					break	
				end switch
			else
				object.index = 23
			end if
			Delta_BecomeGreen = 0
			Object.AnimationTimer = 0
			object.state = DELTA_BATTLEIDLE_3
		end if
	break
	case DELTA_BATTLEEND_8
		CallFunction(Delta_HUD)

		if saved.language >= 1
			Object.BoxLength = 1
		end if

		//killed them both
		CheckEqual(SlenderSpared, 1)
		temp0 = checkResult
		CheckEqual(FreddySpared, 1)
		temp0 &= checkResult
		if temp0 == 1
			switch Delta_TextProgression
			case 99	//dang not bad
				Delta_IsTalking = 1
				Object.index = 106
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break
			case 100	//stronger then i thought
				Delta_IsTalking = 1
				Object.index = 107
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 101	//with that power
				Delta_IsTalking = 1
				Object.index = 108
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 102	//face anything
				Delta_IsTalking = 1
				Object.index = 109
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break		
			case 103	//face anything
				Delta_IsTalking = 1
				Object.index = 110
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break				
			case 104	//face anything
				Delta_IsTalking = 1
				Object.index = 111
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break			
			case 105	//face anything
				Delta_IsTalking = 1
				Object.index = 112
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 106	//face anything
				Delta_IsTalking = 1
				Object.index = 113
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break				
			case 107	//face anything
				Delta_IsTalking = 1
				Object.index = 114
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
					PlaySfx(SfxName[sans], 0)
					text.proceed = 1
				end if
			break	
			end switch
		end if

		//2 = spared  1 = killed
		//killed 
		CheckEqual(SlenderSpared, 1)
		temp0 = checkResult
		CheckEqual(FreddySpared, 2)
		temp0 &= checkResult
		if temp0 == 1
			switch Delta_TextProgression
			case 99	//dang not bad
				Delta_IsTalking = 1
				Object.index = 118
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break
			case 100	
				Delta_IsTalking = 1
				Object.index = 119
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 101	
				Delta_IsTalking = 2
				Object.index = 120
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 102	
				Delta_IsTalking = 1
				Object.index = 121
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break		
			case 103	//face anything
				Delta_IsTalking = 1
				Object.index = 122
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break				
			case 104	//face anything
				Delta_IsTalking = 2
				Object.index = 123
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break			
			case 105	//face anything
				Delta_IsTalking = 1
				Object.index = 124
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 106	//face anything
				Delta_IsTalking = 1
				Object.index = 125
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break			
			case 107	//face anything
				Delta_IsTalking = 2
				Object.index = 126
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break					
			case 108	//face anything
				Delta_IsTalking = 1
				Object.index = 127
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
					PlaySfx(SfxName[sans], 0)
					text.proceed = 1
				end if
			break	
			end switch
		end if

		//2 = spared  1 = killed
		//Slender spared, freddy killed 
		CheckEqual(SlenderSpared, 2)
		temp0 = checkResult
		CheckEqual(FreddySpared, 1)
		temp0 &= checkResult
		if temp0 == 1
			switch Delta_TextProgression
			case 99	//dang not bad
				Delta_IsTalking = 1
				Object.index = 130
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break
			case 100	
				Delta_IsTalking = 1
				Object.index = 131
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 101	
				Delta_IsTalking = 1
				Object.index = 132
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 102	
				Delta_IsTalking = 1
				Object.index = 133
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break		
			case 103	//face anything
				Delta_IsTalking = 1
				Object.index = 134
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break				
			case 104	//face anything
				Delta_IsTalking = 1
				Object.index = 135
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
					PlaySfx(SfxName[sans], 0)
					text.proceed = 1
				end if
			break			
			end switch
		end if


		//killed them both
		CheckEqual(SlenderSpared, 2)
		temp0 = checkResult
		CheckEqual(FreddySpared, 2)
		temp0 &= checkResult
		if temp0 == 1
			switch Delta_TextProgression
			case 99	//dang not bad
				Delta_IsTalking = 1
				Object.index = 138
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break
			case 100	//stronger then i thought
				Delta_IsTalking = 1
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 101	//with that power
				Delta_IsTalking = 1
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 102	//face anything
				Delta_IsTalking = 1
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break		
			case 103	//face anything
				Delta_IsTalking = 1
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break				
			case 104	//face anything
				Delta_IsTalking = 2
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break			
			case 105	//face anything
				Delta_IsTalking = 1
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break	
			case 106	//face anything
				Delta_IsTalking = 2
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
				end if
			break				
			case 107	//face anything
				Delta_IsTalking = 1
				CheckEqual(inputpress.start, 1)
				temp0 = checkResult
				CheckEqual(inputpress.buttonA, 1)
				temp0 |= checkResult				
				if temp0 == 1
					object.charamount = -1
					Delta_TextProgression++
					Object.index++
					PlaySfx(SfxName[sans], 0)
					text.proceed = 1
				end if
			break	
			end switch
		end if


		if Text.Proceed == 0
			//draw the text
			GetTextInfo(temp0, 0, TEXTINFO_TEXTSIZE, Object.Index, 0)
			if object.charamount == temp0

			else
				object.charamount++
				switch Delta_IsTalking
					case 1
					case 3

						CheckGreater(act.selection, -1)
						temp1 = checkResult
						CheckGreater(item.selection, -1)
						temp1 |= checkResult			
						if temp1 == 1
							PlaySfx(SfxName[Text], 0)
						else
							PlaySfx(SfxName[SlenderTalk], false)	
							StopSfx(SfxName[Har1])	
									
						end if
					break
					case 2

						CheckGreater(act.selection, -1)
						temp1 = checkResult
						CheckGreater(item.selection, -1)
						temp1 |= checkResult			
						if temp1 == 1
							PlaySfx(SfxName[Text], 0)
						else
							PlaySfx(SfxName[Har1], false)		
						end if
						StopSfx(SfxName[SlenderTalk])	
						
					break
					default
						PlaySfx(SfxName[Text], false)			
					break
				end switch			
			end if	
		else	//done
			object.timer++
			if object.timer == 100
				Delta_Activate = 0	//its over
				PlaySfx(SfxName[sans], 0)
				stage.activeList = BONUS_STAGE
				stage.listPos = StageName[B - SLENDERMENU]
				LoadStage()	
			end if
		end if
	break
	case DELTA_DIED_90
		if object[currentPlayer].outofbounds == 1
			PlayMusic(10)
			object.alpha = 0
			object.state = DELTA_DIED_FADEIN_91
		end if
	break
	case DELTA_DIED_FADEIN_91
		if object.alpha < 255
			object.alpha += 8
		else
			object.alpha = 255
		end if

		object.timer++
		if object.timer == 400
			object.state++
			object.timer = 0
		end if
	break
	case DELTA_DIED_GAMEOVER_92
		object.timer++
		if object.timer >= 620
			if Final.Fade >= 256
				stage.activeList = BONUS_STAGE
				stage.listPos = StageName[B - SLENDERMENU]
				LoadStage()			
				//restore later
				//CallNativeFunction(ExitGame)
				Final.Fade = 256	
			end if	
		end if

		if object.timer >= 600
			Final.Fade += 16
		end if

		SetClassicFade(color7, color7, color7, Final.Fade)
	break
end switch

	if Delta_SlenderMercy > 100
		Delta_SlenderMercy = 100
	end if

	if Delta_FreddyMercy > 100
		Delta_FreddyMercy = 100
	end if

	if object.state < DELTA_DIED_90
		if Delta_HP <= 0
			StopMusic()
			object.timer = 0
			object.state = DELTA_DIED_90
		end if
	end if

	if stage.debugmode == 1
		if inputpress.buttonY == 1
			Delta_SlenderMercy = 100
			Delta_FreddyMercy = 100	
			Delta_SlenderHP = 1
			Delta_FreddyHP = 1
		end if
	end if

	ProcessObjectControl()


end event

event ObjectDraw
	DrawRect(0, 0, screen.xsize, screen.ysize, 0x00, 0x00, 0x00, 255)
	CallFunction(Delta_BG)

	switch object.state
		case DELTA_START_2
			//BG
			DrawRect(0, HUD.Ypos, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)


			//HUD
			CallFunction(Delta_PlayerHUD)

			//OVERLAY

			temp0 = HUD.Ypos
			temp0 += 18
			DrawRect(0, temp0, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)


			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)
			HUD.Ypos += 17
			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)

			DrawSpriteScreenXY(47, Player.Xpos, screen.ycenter)


			DrawSpriteScreenXY(54, Slender.Xpos, screen.ycenter)

		break
		case DELTA_BATTLEIDLE_3
			//BG
			DrawRect(0, HUD.Ypos, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			//HUD
			CallFunction(Delta_PlayerHUD)

			//OVERLAY

			temp0 = HUD.Ypos
			temp0 += 18
			DrawRect(0, temp0, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			

			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)
			HUD.Ypos += 17
			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)


			object.inkEffect = INK_ALPHA

			ArrayPos0 = 0	//starting letter
				
			object.drawY = 205

			temp3 = screen.xcenter
			temp3 -= 130
			object.drawX = temp3
			

			CallFunction(Delta_TextDrawing)

			switch options.State
			case DELTAOPT_FIGHT_ATTACKING_2	//prep attack
				DrawSpriteScreenXY(187, Player.Xpos, screen.ycenter)
			break
			case DELTAOPT_FIGHT_RESULTS_3	//prep attack
			case DELTAOPT_FIGHT_EFFECTS_4
				if Menu.AttackDamage > 0	//did damage

					if object.animationtimer > 0
						object.animationtimer--
					else
						object.animationtimer = 0
					end if

					if object.animationtimer > 0
						DrawSpriteScreenXY(188, Player.Xpos, screen.ycenter)	//swingin
					else
						DrawSpriteScreenXY(189, Player.Xpos, screen.ycenter)	//swung!
					end if
				else	//you suck man
					DrawSpriteScreenXY(187, Player.Xpos, screen.ycenter)
				end if
			break			
			default
				DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)
			break
			end switch


			switch Options.State
			case DELTAOPT_FIGHT_PICKTARGET_1
			case DELTAOPT_ACT_PICKTARGET_5
			case DELTAOPT_SPARE_CHOOSETARGET_9
				//name handled in main
				//alive?
				CheckEqual(SlenderSpared, 0)
				temp0 = checkResult
				CheckEqual(FreddySpared, 0)
				temp0 &= checkResult
				if temp0 == 1
					switch Delta_AttackTarget
					case 0
						temp3 = screen.xcenter
						temp3 -= 150		
						temp4 = 198
						DrawSpriteScreenXY(75, temp3, temp4)						
					break
					case 1
						temp3 = screen.xcenter
						temp3 -= 150		
						temp4 = 213
						DrawSpriteScreenXY(75, temp3, temp4)	
					break
					end switch
				else
					temp3 = screen.xcenter
					temp3 -= 150		
					temp4 = 198
					DrawSpriteScreenXY(75, temp3, temp4)
				end if
				//HP

				if SlenderSpared == 0
					//Soul next to Slendermans Name
					temp4 = 198
					temp3 = screen.xcenter
					temp3 += 30
					//Backing Red Bar
					DrawRect(temp3, temp4, 50, 8, color4, 0, 0, object.alpha)
					//Green Actual HP Display
					temp2 = 50	
					temp2 *= Delta_SlenderHP
					temp2 /= 100
					temp2 %= 100
					DrawRect(temp3, temp4, temp2, 8, 0, color7, 0, object.alpha)
					DrawSpriteScreenXY(76, temp3, temp4)
					temp4 += 44
					if Delta_SlenderHP > 0
						DrawNumbers(60, temp3, temp4, Delta_SlenderHP, 3, 4, 0)
					else
						DrawNumbers(60, temp3, temp4, 0, 3, 4, 0)
					end if

					temp3 = screen.xcenter
					temp3 += 90
					temp4 = 198
					//Backing Red Bar
					DrawRect(temp3, temp4, 50, 8, color4, 0, 0, object.alpha)
					//Yellow Actual Mercy
					temp2 = 50	
					temp2 *= Delta_SlenderMercy
					temp2 /= 100
					temp2 %= 100
					if Delta_SlenderMercy < 100
						DrawRect(temp3, temp4, temp2, 8, color7, color7, 0, object.alpha)
					else
						DrawRect(temp3, temp4, 50, 8, color7, color7, 0, object.alpha)
					end if
					DrawSpriteScreenXY(77, temp3, temp4)
					temp4 += 44
					if Delta_SlenderMercy < 100
						DrawNumbers(78, temp3, temp4, Delta_SlenderMercy, 3, 4, 0)
					else
						DrawNumbers(78, temp3, temp4, 100, 3, 4, 0)
					end if
				end if

				if FreddySpared == 0
					if SlenderSpared == 0	//Slendermans alive?	Draw Bellow
						//Soul next to Slendermans Name
						temp4 = 213
						temp3 = screen.xcenter
						temp3 += 30
						//Backing Red Bar
						DrawRect(temp3, temp4, 50, 8, color4, 0, 0, object.alpha)
						//Green Actual HP Display
						temp2 = 50	
						temp2 *= Delta_FreddyHP
						temp2 /= 100
						temp2 %= 100
						DrawRect(temp3, temp4, temp2, 8, 0, color7, 0, object.alpha)
						DrawSpriteScreenXY(76, temp3, temp4)
						temp4 += 44
						if Delta_FreddyHP > 0
							DrawNumbers(60, temp3, temp4, Delta_FreddyHP, 3, 4, 0)
						else
							DrawNumbers(60, temp3, temp4, 0, 3, 4, 0)
						end if

						temp3 = screen.xcenter
						temp3 += 90
						temp4 = 213
						//Backing Red Bar
						DrawRect(temp3, temp4, 50, 8, color4, 0, 0, object.alpha)
						//Yellow Actual Mercy
						temp2 = 50	
						temp2 *= Delta_FreddyMercy
						temp2 /= 100
						temp2 %= 100
						if Delta_FreddyMercy < 100
							DrawRect(temp3, temp4, temp2, 8, color7, color7, 0, object.alpha)
						else
							DrawRect(temp3, temp4, 50, 8, color7, color7, 0, object.alpha)
						end if
						DrawSpriteScreenXY(77, temp3, temp4)
						temp4 += 44
						if Delta_FreddyMercy < 100
							DrawNumbers(78, temp3, temp4, Delta_FreddyMercy, 3, 4, 0)
						else
							DrawNumbers(78, temp3, temp4, 100, 3, 4, 0)
						end if
					else	//Take his place
						//Soul next to Slendermans Name
						temp4 = 198
						temp3 = screen.xcenter
						temp3 += 30
						//Backing Red Bar
						DrawRect(temp3, temp4, 50, 8, color4, 0, 0, object.alpha)
						//Green Actual HP Display
						temp2 = 50	
						temp2 *= Delta_FreddyHP
						temp2 /= 100
						temp2 %= 100
						DrawRect(temp3, temp4, temp2, 8, 0, color7, 0, object.alpha)
						DrawSpriteScreenXY(76, temp3, temp4)
						temp4 += 44
						if Delta_FreddyHP > 0
							DrawNumbers(60, temp3, temp4, Delta_FreddyHP, 3, 4, 0)
						else
							DrawNumbers(60, temp3, temp4, 0, 3, 4, 0)
						end if

						temp3 = screen.xcenter
						temp3 += 90
						temp4 = 198
						//Backing Red Bar
						DrawRect(temp3, temp4, 50, 8, color4, 0, 0, object.alpha)
						//Yellow Actual Mercy
						temp2 = 50	
						temp2 *= Delta_FreddyMercy
						temp2 /= 100
						temp2 %= 100
						if Delta_FreddyMercy < 100
							DrawRect(temp3, temp4, temp2, 8, color7, color7, 0, object.alpha)
						else
							DrawRect(temp3, temp4, 50, 8, color7, color7, 0, object.alpha)
						end if
						DrawSpriteScreenXY(77, temp3, temp4)
						temp4 += 44
						if Delta_FreddyMercy < 100
							DrawNumbers(78, temp3, temp4, Delta_FreddyMercy, 3, 4, 0)
						else
							DrawNumbers(78, temp3, temp4, 100, 3, 4, 0)
						end if		
					end if			
				end if





			break
			case DELTAOPT_FIGHT_ATTACKING_2
			case DELTAOPT_FIGHT_RESULTS_3
			case DELTAOPT_FIGHT_EFFECTS_4
				//Icon, Press, Attack bar
				//Head Icon
				temp3 = screen.xcenter
				temp3 -= 140		
				temp4 = object.drawY
				temp4 -= 9
				switch stage.playerlistpos
				case 0
					DrawSpriteScreenXY(88, temp3, temp4)
				break
				case 1
					DrawSpriteScreenXY(89, temp3, temp4)
				break
				case 2
					DrawSpriteScreenXY(90, temp3, temp4)
				break				
				case 5
					DrawSpriteScreenXY(91, temp3, temp4)
				break
				end switch				

				//line
				temp4 += 8
				DrawRect(temp3, temp4, 96, 1, 0, 0, color2, object.alpha)
				//Press A
				temp3 += 20
				temp4 -= 4
				DrawSpriteScreenXY(92, temp3, temp4)
				//Attack bar
				temp3 += 30
				temp4 -= 4
				switch stage.playerlistpos
					case 0
						DrawSpriteScreenXY(93, temp3, temp4)
					break
					case 1
						DrawSpriteScreenXY(181, temp3, temp4)
					break
					case 2
						DrawSpriteScreenXY(182, temp3, temp4)
					break					
					case 5
						DrawSpriteScreenXY(183, temp3, temp4)
					break					
				end switch


				DrawSpriteScreenXY(94, Menu.AttackBar, temp4)

				// DrawNumbers(34, 32, 32, Menu.AttackBar, 3, 8, 0)
				// DrawNumbers(34, 32, 64, Menu.AttackRadius, 3, 8, 0)
				// DrawNumbers(34, 32, 96, Menu.AttackLowerR, 3, 8, 0)

				if options.state == DELTAOPT_FIGHT_EFFECTS_4
					if object.timer > 29
						if Delta_AttackTarget == 0
							temp0 = Slender.xpos
							temp0 -= 16
							Menu.DmgNumberY = 64
						else
							temp0 = Freddy.xpos
							temp0 -= 16
							Menu.DmgNumberY = 120
						end if
						temp0 -= 8
						
						
						GetTableValue(temp2, object.TableContainer, NumberBounce)
						if Object.AltTimer >= 3
							object.TableContainer++
							if object.TableContainer > 14
								object.TableContainer = 14
							end if	
							Object.AltTimer = 0
						end if	

						Menu.DmgNumberY -= temp2
						
						DrawNumbers(95, temp0, Menu.DmgNumberY, Menu.AttackDamage, 3, 10, 0)
					end if
				end if
			break
			case DELTAOPT_ACT_CHOOSEACT_6
				switch Act.Selection
					case 0
						temp3 = screen.xcenter
						temp3 -= 150		
						DrawSpriteScreenXY(75, temp3, 197)
					break
					case 1
						temp3 = screen.xcenter
						temp3 -= 20		
						DrawSpriteScreenXY(75, temp3, 197)
					break		
					case 2
						temp3 = screen.xcenter
						temp3 -= 150		
						DrawSpriteScreenXY(75, temp3, 213)
					break								
				end switch
			break
			case DELTAOPT_ITEM_CHOOSEITEM_7
				switch Item.Selection
					case 0
						temp3 = screen.xcenter
						temp3 -= 150		
						DrawSpriteScreenXY(75, temp3, 197)
					break
					case 1
						temp3 = screen.xcenter
						temp3 -= 20		
						DrawSpriteScreenXY(75, temp3, 197)
					break		
					case 2
						temp3 = screen.xcenter
						temp3 -= 150		
						DrawSpriteScreenXY(75, temp3, 213)
					break	
					default

					break							
				end switch
			break
			case DELTAOPT_SPARE_MERCYCHECK_10


			break
			end switch
		break
		case DELTA_DIALOGUE_4
			DrawRect(0, HUD.Ypos, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			//HUD
			CallFunction(Delta_PlayerHUD)

			//OVERLAY

			temp0 = HUD.Ypos
			temp0 += 18
			DrawRect(0, temp0, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			

			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)
			HUD.Ypos += 17
			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)

			if object.AnimationTimer > 0
				object.AnimationTimer--
				switch object.animation	//Idle
				case 0
					DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)
				break
				case 1	//Act
					DrawSpriteScreenXY(49, Player.Xpos, screen.ycenter)
				break		
				case 2	//Hurt
					DrawSpriteScreenXY(53, Player.Xpos, screen.ycenter)
				break			
				case 3	//Ittem
					DrawSpriteScreenXY(50, Player.Xpos, screen.ycenter)
				break		
				case 4	//Defend
					DrawSpriteScreenXY(52, Player.Xpos, screen.ycenter)
				break		
				end switch
			else
				object.AnimationTimer = 0
				DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)
			end if
			


			object.inkEffect = INK_ALPHA

			ArrayPos0 = 0	//starting letter

			CheckGreater(act.Selection, -1)
			temp1 = checkResult
			CheckGreater(item.Selection, -1)
			temp1 |= checkResult			
			if temp1 == 1
				object.drawY = 205

				temp3 = screen.xcenter
				temp3 -= 130
				object.drawX = temp3
				

				CallFunction(Delta_TextDrawing)
			else
			
				switch Delta_IsTalking
				case 0	//you
					temp1 = Player.Xpos
					temp1 += 80
					temp2 = screen.ycenter
					temp2 += 12
					DrawSpriteScreenXY(106, temp1, temp2)

					temp2 -= 36
					object.drawY = temp2

					temp1 -= 22
					object.drawX = temp1
				break
				case 1	//slenderman
					temp1 = Slender.Xpos
					temp1 -= 75
					temp2 = screen.ycenter
					temp2 -= 32
					DrawSpriteScreenXY(192, temp1, temp2)

					temp2 -= 36
					object.drawY = temp2

					temp1 -= 34
					object.drawX = temp1
				break
				case 2	//freddy
					temp1 = Freddy.Xpos
					temp1 -= 60
					temp2 = screen.ycenter
					temp2 += 16
					DrawSpriteScreenXY(192, temp1, temp2)

					temp2 -= 36
					object.drawY = temp2

					temp1 -= 34
					object.drawX = temp1
				break		
				case 3	//slenderman opening
					temp1 = Slender.Xpos
					temp1 -= 55
					temp2 = screen.ycenter
					temp2 += 0
					DrawSpriteScreenXY(192, temp1, temp2)

					temp2 -= 36
					object.drawY = temp2

					temp1 -= 34
					object.drawX = temp1
				break						
				default

				break
				end switch


				CallFunction(Delta_TalkingText)			
			end if

			if act.Selection == 1
				DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)
				DrawSpriteScreenXY(170, screen.xcenter, screen.ycenter)
			end if

			if Text.Proceed == 3
				DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)
			end if			

		break
		case DELTA_ATTACKSTART_5
			//BG
			DrawRect(0, HUD.Ypos, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			//HUD
			CallFunction(Delta_PlayerHUD)

			//OVERLAY

			temp0 = HUD.Ypos
			temp0 += 18
			DrawRect(0, temp0, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			

			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)
			HUD.Ypos += 17
			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)

			if Delta_Defending == 0
				DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)	//normal
			else
				DrawSpriteScreenXY(52, Player.Xpos, screen.ycenter)	//defend anim
			end if

		

			temp0 = screen.xcenter
			temp1 = screen.ycenter
			temp1 -= 16
			DrawSpriteScreenFX(105, FX_ROTOZOOM, temp0, temp1)

			if object.rotation < 512
				object.rotation += 8
			else
				object.rotation = 512
			end if


			if object.scale < 512
				object.scale += 8
			else
				object.scale = 512
			end if
			
		break
		case DELTA_ATTACKING_6
			//BG
			DrawRect(0, HUD.Ypos, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			//HUD
			CallFunction(Delta_PlayerHUD)

			//OVERLAY

			temp0 = HUD.Ypos
			temp0 += 18
			DrawRect(0, temp0, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			

			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)
			HUD.Ypos += 17
			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)

		

			temp0 = screen.xcenter
			temp1 = screen.ycenter
			temp1 -= 16
			DrawSpriteScreenXY(105, temp0, temp1)

			if Delta_Defending == 1
				DrawSpriteScreenXY(52, Player.Xpos, screen.ycenter)
			else
				if object.AnimationTimer > 0
					object.AnimationTimer--
					switch object.animation	//Idle
					case 0
						DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)
					break
					case 2	//Act
						DrawSpriteScreenXY(53, Player.Xpos, screen.ycenter)
					break				
					end switch
				else
					DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)
				end if
			end if

			if Delta_ShowMercy == 1
				if Delta_AttackTarget == 0 //slender mercy
					temp0 = Slender.xpos
					temp0 -= 16
					Mercy.NumberY = 64
					

					Object.AltTimer++
					GetTableValue(temp2, object.TableContainer, NumberBounce)
					if Object.AltTimer >= 3
						object.TableContainer++
						if object.TableContainer > 14
							object.TableContainer = 14
						end if	
						Object.AltTimer = 0
					end if	

					Mercy.NumberY -= temp2
					
					DrawNumbers(171, temp0, Mercy.NumberY, Delta_SlenderMercy, 3, 10, 0)
				else
					temp0 = Freddy.xpos
					temp0 -= 16
					Mercy.NumberY = 128
					

					Object.AltTimer++
					GetTableValue(temp2, object.TableContainer, NumberBounce)
					if Object.AltTimer >= 3
						object.TableContainer++
						if object.TableContainer > 14
							object.TableContainer = 14
						end if	
						Object.AltTimer = 0
					end if	

					Mercy.NumberY -= temp2
					
					DrawNumbers(171, temp0, Mercy.NumberY, Delta_FreddyMercy, 3, 10, 0)
				end if
			end if
		
			
		break	
		case DELTA_ATTACKEND_7
			Delta_ShowMercy = 0
			//BG
			DrawRect(0, HUD.Ypos, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			//HUD
			CallFunction(Delta_PlayerHUD)

			//OVERLAY

			temp0 = HUD.Ypos
			temp0 += 18
			DrawRect(0, temp0, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			

			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)
			HUD.Ypos += 17
			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)

			DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)
		

			temp0 = screen.xcenter
			temp1 = screen.ycenter
			temp1 -= 16
			DrawSpriteScreenFX(105, FX_ROTOZOOM, temp0, temp1)


		break		
		case DELTA_BATTLEEND_8
			DrawRect(0, HUD.Ypos, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			//HUD
			CallFunction(Delta_PlayerHUD)

			//OVERLAY

			temp0 = HUD.Ypos
			temp0 += 18
			DrawRect(0, temp0, screen.xsize, screen.ysize, 0, 0, 0, object.alpha)

			

			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)
			HUD.Ypos += 17
			DrawRect(0, HUD.Ypos, screen.xsize, 1, color2, color1, color2, object.alpha)

			object.AnimationTimer = 0
			DrawSpriteScreenXY(46, Player.Xpos, screen.ycenter)


			object.inkEffect = INK_ALPHA

			ArrayPos0 = 0	//starting letter


			switch Delta_IsTalking
			case 0	//you
				temp1 = Player.Xpos
				temp1 += 80
				temp2 = screen.ycenter
				temp2 += 12
				DrawSpriteScreenXY(106, temp1, temp2)

				temp2 -= 36
				object.drawY = temp2

				temp1 -= 22
				object.drawX = temp1
			break
			case 1	//slenderman
				temp1 = Slender.Xpos
				temp1 -= 75
				temp2 = screen.ycenter
				temp2 -= 32
				if Object.BoxLength == 0
					DrawSpriteScreenXY(192, temp1, temp2)
				else
					DrawSpriteScreenXY(212, temp1, temp2)
				end if

				temp2 -= 36
				object.drawY = temp2

				temp1 -= 34
				object.drawX = temp1
			break
			case 2	//freddy
				temp1 = Freddy.Xpos
				temp1 -= 60
				temp2 = screen.ycenter
				temp2 += 16
				if Object.BoxLength == 0
					DrawSpriteScreenXY(192, temp1, temp2)
				else
					DrawSpriteScreenXY(212, temp1, temp2)
				end if

				temp2 -= 36
				object.drawY = temp2

				temp1 -= 34
				object.drawX = temp1
			break		
			case 3	//slenderman opening
				temp1 = Slender.Xpos
				temp1 -= 55
				temp2 = screen.ycenter
				temp2 += 0
				DrawSpriteScreenXY(192, temp1, temp2)

				temp2 -= 36
				object.drawY = temp2

				temp1 -= 34
				object.drawX = temp1
			break						
			default

			break
			end switch


			CallFunction(Delta_TalkingText)			
			

			if act.Selection == 1
				DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)
				DrawSpriteScreenXY(170, screen.xcenter, screen.ycenter)
			end if

			if Text.Proceed == 1
				DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)
			end if

		break			
		case DELTA_DIED_90
			DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)
		break	
		case DELTA_DIED_FADEIN_91
		case DELTA_DIED_GAMEOVER_92
			DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)

			DrawSpriteScreenFX(184, FX_INK, screen.xcenter, screen.ycenter)
		break			
	end switch
	
	if object.state == DELTA_DIALOGUE_4
		if act.selection != 1
			Callfunction(Delta_CharAnim)
		end if
	else
		Callfunction(Delta_CharAnim)
	end if

	//debug stuff
	// temp5 = act.Selection
	// abs(temp5)
	//DrawNumbers(34, 32, 32, SlenderSpared, 3, 8, 0)
	//DrawNumbers(34, 32, 64, FreddySpared, 3, 8, 0)
	//DrawNumbers(34, 32, 96, Attack.Property, 3, 8, 0)


	if saved.mobile == 1
		Callfunction(Delta_TouchDraw)
	end if

	if object.state == DELTA_BATTLEEND_8
		if text.proceed == 1
			DrawRect(0, 0, screen.xsize, screen.ysize, 0, 0, 0, 255)
		end if
	end if
end event

event ObjectStartup
	LoadSpriteSheet("3D_Test/DeltaSheet.gif")
	switch saved.language
		case 0
			LoadTextFile(0, "Data/Game/FreddyBattle.txt")
		break
		case 1 //PTBR
			LoadTextFile(0, "Data/Game/Portuguese/FreddyBattle.txt")
		break		
		case 2 //ES
			LoadTextFile(0, "Data/Game/Spanish/FreddyBattle.txt")
		break		
		case 3 //French
			LoadTextFile(0, "Data/Game/French/FreddyBattleFR.txt")
		break			
	end switch
	SetMusicTrack("DeltaDie.ogg", 10, 1)
	if saved.SlenderOST == 0
		SetMusicTrack("FreddyBuster.ogg", 11, 1)
	else
		SetMusicTrack("SlendyBattle2M.ogg", 11, 1)
	end if
	SpriteFrame(0, 0, 0, 0, 0, 0)	//0 the bar


	// 0-33
	temp5 = 1
	while temp5 < 21
		temp6 = 256
		while temp6 < 354
			SpriteFrame(-3, -6, 8, 7, temp6, temp5)
			temp6 += 9
		loop
		temp5 += 7
	loop	

	//34-43		0-9		Big Numbers
	SpriteFrame(0, 0, 8, 13, 467, 484)
	SpriteFrame(0, 0, 8, 13, 476, 484)
	SpriteFrame(0, 0, 8, 13, 485, 484)
	SpriteFrame(0, 0, 8, 13, 494, 484)
	SpriteFrame(0, 0, 8, 13, 503, 484)
	SpriteFrame(0, 0, 8, 13, 467, 498)
	SpriteFrame(0, 0, 8, 13, 476, 498)
	SpriteFrame(0, 0, 8, 13, 485, 498)
	SpriteFrame(0, 0, 8, 13, 494, 498)
	SpriteFrame(0, 0, 8, 13, 503, 498)

	//44 BG Front
	SpriteFrame(0, 0, 64, 64, 1, 234)
	//45 BG Back
	SpriteFrame(0, 0, 64, 64, 1, 169)	
	//Battle Player	- 
	switch stage.playerlistpos
	case 0
	case 3
		SpriteFrame(0, -18, 30, 38, 1, 10)	//46 Idle
		SpriteFrame(-6, -18, 34, 36, 32, 12)	//47 Battle Enter
		SpriteFrame(0, -18, 30, 38, 1, 10)	//48 Fight
		SpriteFrame(0, -20, 34, 40, 97, 8)	//49 Act
		SpriteFrame(2, -19, 29, 39, 175, 9)	//50 Item
		SpriteFrame(0, -20, 34, 40, 97, 8)	//51 Mercy
		SpriteFrame(2, -19, 29, 39, 67, 9)	//52 Defend	
		SpriteFrame(0, -18, 40, 38, 134, 10)	//53 Hurt	
	break
	case 1
		SpriteFrame(0, -11, 32, 31, 78, 480)	//46 Idle
		SpriteFrame(0, -9, 32, 29, 111, 482)	//47 Battle Enter
		SpriteFrame(0, -11, 32, 31, 78, 480)	//48 Fight
		SpriteFrame(-1, -12, 39, 32, 183, 479)	//49 Act
		SpriteFrame(2, -19, 31, 39, 256, 472)	//50 Item
		SpriteFrame(-1, -12, 39, 32, 183, 479)	//51 Mercy
		SpriteFrame(-2, -3, 38, 23, 144, 488)	//52 Defend	
		SpriteFrame(2, -18, 32, 32, 223, 479)	//53 Hurt	
	break	
	case 2
	case 4
		SpriteFrame(0, -20, 27, 40, 78, 439)	//46 Idle
		SpriteFrame(-4, -20, 41, 36, 106, 443)	//47 Battle Enter
		SpriteFrame(0, -20, 27, 40, 78, 439)	//48 Fight
		SpriteFrame(2, -19, 32, 39, 186, 439) //49 Act
		SpriteFrame(-4, -25, 38, 45, 256, 426)	//50 Item
		SpriteFrame(2, -19, 32, 39, 186, 439)	//51 Mercy
		SpriteFrame(0, -20, 27, 40, 148, 439)	//52 Defend	
		SpriteFrame(2, -18, 36, 38, 219, 440)	//53 Hurt	
	break		
	case 5
		SpriteFrame(0, -16, 23, 36, 78, 402)	//46 Idle
		SpriteFrame(0, -14, 26, 32, 102, 406)	//47 Battle Enter
		SpriteFrame(0, -16, 23, 36, 78, 402)	//48 Fight
		SpriteFrame(2, -15, 22, 35, 156, 403)	//49 Act
		SpriteFrame(2, -20, 27, 40, 206, 398)	//50 Item
		SpriteFrame(0, -20, 34, 40, 97, 8)	//51 Mercy
		SpriteFrame(0, -11, 26, 31, 129, 407)	//52 Defend	
		SpriteFrame(0, -12, 26, 29, 179, 409)	//53 Hurt	
	break	
	default
		SpriteFrame(0, 0, 0, 0, 0, 0)	//46 Idle
		SpriteFrame(0, 0, 0, 0, 0, 0)	//47 Battle Enter
		SpriteFrame(0, 0, 0, 0, 0, 0)	//48 Fight
		SpriteFrame(0, 0, 0, 0, 0, 0)	//49 Act
		SpriteFrame(0, 0, 0, 0, 0, 0)	//50 Item
		SpriteFrame(0, 0, 0, 0, 0, 0)	//51 Mercy
		SpriteFrame(0, 0, 0, 0, 0, 0)	//52 Defend	
		SpriteFrame(0, 0, 0, 0, 0, 0)	//53 Hurt	
	break
	end switch

	//Slenderman!!!
	SpriteFrame(0, -43, 35, 63, 67, 100)	//54 Idle
	SpriteFrame(0, -41, 40, 62, 103, 101)	//55 Hurt

	SpriteFrame(-50, -44, 111, 34, 256, 32)	//56 Sonic HUD
	SpriteFrame(-50, -44, 111, 34, 400, 1)	//57 Tails HUD
	SpriteFrame(-50, -44, 111, 34, 400, 36)	//58 Knuckles HUD
	SpriteFrame(-50, -44, 111, 34, 400, 71)	//59 Amy HUD

	//delta numbers
	//60-69
	temp6 = 256
	while temp6 < 295
		SpriteFrame(26, -42, 3, 5, temp6, 67)
		temp6 += 4
	loop
	
	//70-74	Highlighted Actions
	SpriteFrame(0, -27, 15, 19, 256, 74)	//Fight
	SpriteFrame(0, -27, 16, 19, 275, 74)	//Act
	SpriteFrame(0, -27, 15, 19, 295, 74)	//Item
	SpriteFrame(0, -27, 16, 19, 314, 74)	//Spare
	SpriteFrame(0, -27, 15, 19, 334, 74)	//Defend	

	SpriteFrame(0, 0, 10, 10, 256, 94)	//Soul	75
	SpriteFrame(0, -6, 7, 5, 267, 94)	//HP	76
	SpriteFrame(0, -6, 21, 5, 275, 94)	//Mercy	77

	//delta numbers	but dark
	//78-87
	temp6 = 336
	while temp6 < 375
		SpriteFrame(26, -42, 3, 5, temp6, 67)
		temp6 += 4
	loop

	//Char Heads
	SpriteFrame(0, -6, 15, 14, 261, 34)	//88 Sonic
	SpriteFrame(0, -6, 13, 13, 406, 4)	//89 T
	SpriteFrame(0, -6, 16, 13, 405, 39)	//90 K
	SpriteFrame(0, -6, 16, 14, 405, 73)	//91 A

	SpriteFrame(0, -6, 22, 5, 267, 100)	//92 Press A

	SpriteFrame(0, -6, 54, 15, 256, 110)	//93 Sonic Bar

	SpriteFrame(0, -6, 3, 15, 311, 110)	//94 White Bar	

	//Damage Numbers
	//95-104
	temp6 = 369
	while temp6 < 478
		SpriteFrame(0, 0, 10, 10, temp6, 106)
		temp6 += 11
	loop

	SpriteFrame(-38, -38, 75, 75, 436, 129)	//105 Green Box

	SpriteFrame(-38, -38, 100, 48, 100, 213)	//106 Speech Bubble

	//big mc font
	//107-133
	temp5 = 142
	while temp5 < 157
		temp6 = 256
		while temp6 < 333
			SpriteFrame(0, 1, 5, 7, temp6, temp5)
			temp6 += 6
		loop
		temp5 += 8
	loop	

	//small mc font
	//134-158
	temp4 = 163
	while temp4 < 182
		temp3 = 256
		while temp3 < 333
			SpriteFrame(0, 0, 5, 9, temp3, temp4)
			temp3 += 6
		loop
		temp4 += 10
	loop	

	//but casteor why not use FX_FLIP?		idk?? i thought i'd need it for something more important but i guess not really? and im already too far in to remove this so
	SpriteFrame(-38, -38, 84, 48, 427, 254)	//159 Speech Bubble	Right

	//Text Numbers 0-9

	//160-169
	temp6 = 175
	while temp6 < 255
		SpriteFrame(-3, -6, 8, 7, temp6, 1)
		temp6 += 8
	loop

	SpriteFrame(-38, -38, 76, 84, 1, 427)	//170 Speech Bubble	Right	

	//Mercy Numbers
	//171 - 180
	temp6 = 369
	while temp6 < 478
		SpriteFrame(0, 0, 10, 10, temp6, 118)
		temp6 += 11
	loop	

	SpriteFrame(0, -6, 54, 15, 201, 164)	//181 T Bar
	SpriteFrame(0, -6, 54, 15, 201, 180)	//182 K Bar	
	SpriteFrame(0, -6, 54, 15, 201, 196)	//183 A Bar

	SpriteFrame(-80, -16, 160, 32, 306, 479)	//Game Over 184

	//Minecraft font
	SpriteFrame(0, 0, 5, 9, 262, 188)	//?	185
	SpriteFrame(0, 0, 5, 9, 256, 188)	//!	186

	switch stage.playerlistpos
	case 0
	case 3
		SpriteFrame(3, -19, 30, 39, 1, 387)		//187 Fight 1
		SpriteFrame(3, -19, 34, 39, 1, 347)		//188 Fight 2
		SpriteFrame(3, -19, 30, 39, 32, 387)	//189 Fight 3
	break
	case 1
		SpriteFrame(0, -11, 32, 31, 64, 370)		//187 Fight 1
		SpriteFrame(0, -11, 26, 31, 97, 370)		//188 Fight 2
		SpriteFrame(0, -12, 31, 32, 124, 369)	//189 Fight 3
	break	
	case 2
	case 4
		SpriteFrame(0, -19, 32, 39, 295, 439)		//187 Fight 1
		SpriteFrame(0, -20, 35, 40, 328, 438)		//188 Fight 2
		SpriteFrame(0, -18, 30, 38, 364, 440)	//189 Fight 3
	break	
	case 5
		SpriteFrame(0, -16, 24, 36, 395, 442)	//187 Idle
		SpriteFrame(0, -16, 40, 36, 420, 442)	//188 Idle
		SpriteFrame(0, -16, 27, 36, 461, 442)	//189 Idle
	break		
	default
		SpriteFrame(0, 0, 0, 0, 0, 0)
		SpriteFrame(0, 0, 0, 0, 0, 0)
		SpriteFrame(0, 0, 0, 0, 0, 0)
	break
	end switch

	//Minecraft font			again			Grammar folks!
	SpriteFrame(0, 0, 5, 9, 286, 188)	//.	190
	SpriteFrame(0, 0, 5, 9, 268, 188)	//'	191

	SpriteFrame(-38, -38, 100, 48, 100, 164)	//192 Speech Bubble	Right Long

	//Freddy
	SpriteFrame(0, -43, 32, 63, 67, 164)	//193 Idle
	SpriteFrame(0, -43, 32, 63, 67, 164)	//194 Locked In
	SpriteFrame(0, -43, 41, 60, 201, 212)	//195 Hurt
	SpriteFrame(0, -43, 32, 63, 67, 228)	//196 Down

	//Slenderman!!!
	SpriteFrame(-6, -41, 64, 61, 184, 102)	//197 Locked in
	SpriteFrame(0, -21, 63, 35, 100, 262)	//198 Spared

	SpriteFrame(0,0,64,66,164,273) //199 DPAD
	SpriteFrame(26,0,12,25,280,337) //201 DPAD up press
	SpriteFrame(26,0,12,26,280,374) //202 DPAD down press
	SpriteFrame(0,25,26,13,253,374) //203 DPAD left press
	SpriteFrame(0,25,26,13,253,388) //204 DPAD right press
	SpriteFrame(0,0,48,48,229,273) //205 A button
	SpriteFrame(0,0,48,48,229,322) //206 A button down

	SpriteFrame(0,0,48,48,115,298) //207 B button
	SpriteFrame(0,0,48,48,66,298) //208 B button down

	SpriteFrame(-50, -44, 111, 34, 400, 407)	//209 Blank HUD

	SpriteFrame(-3, -6, 8, 7, 355, 9) //209 // '  yes really theres more


	//MC

	SpriteFrame(0, 0, 5, 9, 310, 188)  //210 // ,  yes really theres more

	//normal

	SpriteFrame(-3, -6, 8, 7, 355, 18)  //211 // -  yes really theres more	

	SpriteFrame(-38, -38, 100, 61, 295, 375)	//212?? Speech Bubble	Right Long Tall

	// Place the HUD object into reserved object slot 4 and initialise its values
	Object[40].Type = TypeName[Freddy Battle]
	
	// The object should always be run, regardless if it's within camera bounds or not
	Object[40].Priority = PRIORITY_ACTIVE
	
	// Make the HUD draw ontop of all other sprites, too
	Object[40].DrawOrder = 6

end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("IIZ/Objects1.gif")
	SpriteFrame(0, 0, 64, 64, 153, 154)
end event
